cedccefe92
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