Code Monkey home page Code Monkey logo

brein-time-utilities's People

Contributors

allisun-wang avatar eklinger avatar havenwang avatar marcorecchioni avatar pmeisen avatar toddbodnar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

brein-time-utilities's Issues

IntervalTree thread safety

Hello, is the interval tree thread safe? It doesn't seem so but then what is the purpose of the atomic boolean being used in remove?

Thread Safety

Hello,
I am interested in making the interval tree thread-safe and wanted to get your feedback on the various approaches, feasibility, etc. For my case I will have many more readers than writers and writes will be infrequent compared to reads.

  1. Seems like a ReadWriteLock might suffice here. Simply wrapping the modifying methods with a write lock and a read lock for the read methods. May lower throughput quite a bit depending upon thread contention.
  2. Potentially a lock-free version could be achieved if you can find a serialization point/node in the tree under which the modification would take place and then separately rebuild that subtree and then use a CAS operation to update that node in the original tree. I'm not quite sure how the self-balancing aspect of the tree might affect this.

Are there any other ideas that might work? Have you had a need for thread safety in your own use?

Thanks again!

IntervalTree performance

Hello,
Have you done any benchmarking on the tree? I am not quite sure what performance to expect, so let me describe my use case.
I have a map, mapping keys to interval trees. In the worst case there are about 35 keys in the map and in turn I query 35 interval trees. Each tree has ~1000 items in it. The overlap query is not cutting the tree down by much (by design), so I am fetching close to all items from each tree. Doing this sequentially and then combining all tree overlap streams into a single list is taking ~40-50ms, which seems a bit high.
psuedo code:
map.entrySet().stream().map(e -> e.value().overlaps(query)).flatMap(identity()).map(id -> getObject(id)).collect(toList());
getObject() is just a lookup in another map to get the object from the id in the tree.
Simply changing this to a parallelStream() improved the performance by ~4x.
Do you have any pointers or guidance on improving the performance of the tree? Or Is this even the right approach? It is still a bit baffling to me why the sequential performance is not as high as I would imagine.
Thanks!

IDInterval Comparing IDs

Hi,
In com.brein.time.timeintervals.intervals.IdInterval.compareId(IdInterval), the method is using compareTo() to compare the ids. Should this be equals() instead? Thanks!

Sorted Intervals

Hi Phillipp,
Is there no way to traverse the tree in sorted order of the intervals? It doesn't seem like there is with an augmented interval tree but wanted to check with you. Thanks

Is compareTo in IInterval being used?

Hi, I'm trying to use the library for a custom type. So, I've implemented IInterval interface.
Since, it IInterval extends Comparable, I thought, the tree uses IInterval's compareTo() method for comparison.

But, it seems the tree uses valueComparator from IntervalValueComparator to compare nodes.

So, my question is, is compareTo() in IInterval being used, somewhere?

Wrong interval relation

Hi,

The following code output OVERLAPS instead of the expected AFTER. What am I doing wrong?

        LongInterval i1 = new LongInterval(1L, 5L);
        LongInterval i2 = new LongInterval(8L, 10L);
        System.out.println(i1.ir(i2));

I'm using version 1.6.2.

Thanks,
Carlos

Interval deletion operation

Could you please augment the interval tree to include the operations of deletions of intervals? Including the possibility to efficiently remove several nodes in the tree given an interval?

Iteration Order

Hello,
Does the iterator return entries according to the comparator, e.g. in ascending order of the intervals?

Thanks
Evan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.