Commit Graph

101 Commits

Author SHA1 Message Date
c9dcbdbe97 performance improvements
the heap refill code was recursively implemented with two methods.
I merged both methods.

replace recursion in heap refill method with iterative approach

use array for list of LongQueue
This way there is no precondition when accessing the elements
2020-11-07 08:36:07 +01:00
a427df09aa changed the value of UNSET from Long.MIN_VALUE to LONG.MAX_VALUE
That made the code in fillWithMinOfChildren() easier. We lost an early
out, though. But that should be negligible.
2020-11-06 19:41:48 +01:00
8a5309fbe8 multiway merge of multiple sorted lists 2020-11-06 19:22:45 +01:00
5b5e948293 update dependencies 2020-11-05 17:55:55 +01:00
3f4b5b409a update gradle 2020-11-05 17:53:47 +01:00
2b85828700 update gradle 2020-07-11 17:26:41 +02:00
d76551db2c update 3rd party libs 2019-12-27 12:14:09 +01:00
c6f5a3d2fe add Sparse2DLongArray 2019-12-26 15:44:58 +01:00
ec7a03f068 LongLongHashMap.get should no longer throw NoSuchElementException
In many use cases it is more efficient to have a getter that returns
a default value instead of throwing an exception. The exception forces
every consumer to call containsKey() before calling get(). In cases
where the consumer wants to use a default value this is unnecessary.
2019-12-22 19:14:41 +01:00
955b410ba3 update 3rd party libs 2019-12-22 19:09:37 +01:00
98bdb35c40 update gradle versions plugin to 0.24.0 2019-09-07 17:54:50 +02:00
0751802dd0 update gradle to 5.6.2 2019-09-07 17:53:38 +02:00
6421b82ce1 remove benchmark harness
we are using JMH instead
2019-09-07 17:52:14 +02:00
9f60c59aca add JMH tests for union of long list and uniq of lon/int list 2019-09-07 17:49:53 +02:00
452ef2020d fix LongLongHashMap.forEachOrdered for negative values 2019-09-07 16:51:30 +02:00
4d92197423 fix stackoverflow in Int/LongList.intersectionUnsorted 2019-09-07 16:50:40 +02:00
86f12e0af6 Add hash map for long to long mappings. 2019-09-07 14:36:51 +02:00
097b7ab110 add more JMH tests 2019-09-01 15:47:10 +02:00
0311ecd83c recover deleted JMH tests
update gradle and other third-party libs
2019-08-22 19:57:27 +02:00
506fb7b698 add new method 'uniq()' 2019-08-22 19:21:24 +02:00
ed703db277 speed improvement for intersectionSorted()
Using the unsafe versions of add/get to improve performance.

Here are some numbers for 2^15 intersections of two random
sorted lists with 16k elements. The numbers were gathered with
perf stat -d -d -d --delay 2000 java -ea -cp bin/test:bin/main
org.lucares.collections.Test 16000 15 (the test class is not committed)

Duration: 9059ms -> 7293ms (80.5%)
Cycles: 26.084.812.051 -> 21.616.608.207 (82.9%)
Instructions: 68.045.848.666 -> 52.306.000.150 (76.9%)
Instructions per Cycle: 2,61 -> 2.42
Branches: 15.007.093.940 -> 9.839.481.658 (65.6%)
Branch Misses: 2.285.461 -> 1.551.906
Cycles per element: 24.87 -> 20.61 (82.9%)
2019-04-28 12:48:17 +02:00
cedccefe92 20% speedup of unionSorted()
Added getUnsafe and addUnsafe, two methods that skip checks.
The checks are not needed in unionSorted, because we made
sure the code works correctly. getUnsafe still has the checks,
but as assertions.

The speedup is roughly 20%. Here are some results for calling
union 2^16 times for two random sorted lists with 16k
elements:
Duration: 20170 -> 16857 (83.57%)
Instructions: 138.277.743.679 -> 108.474.027.213 (78.4%)
Instructions per cycle: 2,33 -> 2,18
Branches: 30.248.330.644 -> 19.908.207.057 (65.8%)
Branch Misses: 3.012.427 -> 3.477.433
Cycles per list element: 65.93 -> 51.72 (78.4%)

Created with (the test program is not committed) on a Core2Duo 8600:
perf stat -d -d -d --delay 2000 java -cp bin/test:bin/main
org.lucares.collections.Test 16000 16
2019-04-28 11:05:13 +02:00
1420c21732 update 3rd party libs and gradle 2019-04-27 18:04:59 +02:00
528e0b3ba3 update gradle to 5.2.1 2019-02-17 09:13:40 +01:00
b31f756500 addAll for a collection of LongLists
The benefit is, that we only need one memory allocation.
2019-02-17 09:11:09 +01:00
e594e09946 update junit 2019-01-04 17:02:23 +01:00
635458778b update gradle to 5.1 2019-01-04 16:59:04 +01:00
5072f43474 update version 2018-11-20 19:57:31 +01:00
ee04f21f29 removeAll is now O(n+m) if both lists are sorted 2018-11-20 19:53:33 +01:00
430b4c50ca update 4rd-party libs 2018-11-20 19:25:34 +01:00
6cc4a704fe add .reviewboardrc so that we might be able to use the review board 2018-11-09 07:03:11 +01:00
fef9af51cd add different versions of IntList.insert and LongList.insert
The new methods are more flexible, so that you can insert
parts of an array.
2018-09-23 15:28:37 +02:00
b99021d0f7 extract duplicate code that checks if the list is sorted 2018-09-13 20:02:54 +02:00
29e298dd35 add information on how to get artifacts 2018-09-13 17:53:25 +00:00
7201dde072 update README.md with a list of supported methods and an example 2018-09-13 17:42:53 +00:00
9bf4abe3ec add gradle-versions plugin and update junit to 5.3.1 2018-09-13 19:05:35 +02:00
81fb565b1d update gradle to 4.10.1 2018-09-13 19:01:02 +02:00
1d0d3e6d2b add *List.range() and *List.rangeClosed() 2018-09-08 08:48:47 +02:00
336905fafe clear() not longer frees memory it just empties the list
Use case: The list is used as a buffer, that is re-used and in
each iteration the list is cleared.

Now that clear() does not replace the data array there is no
garbage collection and we do not have to allocated one or
several new arrays in the next iteration.
You can still free the associated memory by calling clear() + trim().
2018-08-17 19:38:30 +02:00
1994400f97 make jnuit5 tests actually executable in gradle 2018-08-17 19:34:42 +02:00
a8658480ce update to gradle 4.9 2018-08-17 18:45:15 +02:00
19886eff89 update to Junit 5 2018-08-17 18:44:38 +02:00
a5b58cb1b5 update gradle to 4.7 2018-05-19 19:50:19 +02:00
fa0c7136a4 add LongList
It is an exact copy of IntList.
2018-01-24 19:15:19 +01:00
bd6c595856 extract inline definitions of generators, add loop for different sizes 2018-01-22 18:51:40 +01:00
bfbddf3fb1 cleanup
- Remove TODO in unionUnsorted, because I don't think there is a much
  better solution.
- Remove TODO for lastIndexOf, because it has been implemented.
- Use local variables for size in unionSorted.
2018-01-22 18:50:53 +01:00
7edd2adad8 cleanup
remove obsolete jmh test
2018-01-22 18:23:18 +01:00
7de2ac1fd3 add test for hashcode/equals with sorted and unsorted lists 2018-01-22 18:22:14 +01:00
67c16460d8 remove jmh 2018-01-22 18:21:40 +01:00
c5e49b388b update gradle to 4.4.1 2018-01-22 18:14:10 +01:00