bicache
bicache copied to clipboard
performance review
This is an in-memory cache; every cycle counts.
Also see: https://github.com/jamiealquiza/bicache/issues/20, https://github.com/jamiealquiza/bicache/issues/17
PromoteEvict
/ sll.Remove
has a > 500x speedup w/ 25K nodes here: https://github.com/jamiealquiza/bicache/commit/49dd2b16ea6eaccdd0389623eb127be82aeebbaa
^ Had bugs, rolled back. Pending reintroduction in https://github.com/jamiealquiza/bicache/issues/7.
Exchanged sll's mutex-guarded counter with an atomic CAS here https://github.com/jamiealquiza/bicache/commit/817289f3a670f15055c824d739bd99e2107f6ec5
Switched the removeFromScores
search algo to an unrolled linear search here https://github.com/jamiealquiza/bicache/commit/0dec79993e67ef1fa0c8edf3d648a0f9e0853f3a
Sll can pre-allocate an internal nodeScoreList with specific size (e.g. the capacity of a cache implementing sll). This improved initial insert times for 100k items by ~50%. https://github.com/jamiealquiza/bicache/commit/a9e97437f45b2646e8b51521bd7ec4d1e9b708fe
Sll refactor reduces instructions per op https://github.com/jamiealquiza/bicache/commit/a8ebb453c8fbd24701bfc505db8924073a150207
Removed deferred mutex unlocks https://github.com/jamiealquiza/bicache/commit/52c1f3b1ad15ec9e2c36a7413dd65d870bd5fac8. Get perf seems to have improved; needs comparative testing.
https://github.com/jamiealquiza/bicache/issues/22 and https://github.com/jamiealquiza/bicache/issues/11 were closed.
1,500x improvement in PromoteEvict https://github.com/jamiealquiza/bicache/compare/430917024a989dd1800053acb2eb851654d8e245...5aa26f2a7d621afc6daddfa20960ca0bfee457e5
Tail eviction speed up https://github.com/jamiealquiza/bicache/commit/c72347bf481c56ed65ca2910cf9aa0579c87d6e4
Sll node removal avoids mem copies https://github.com/jamiealquiza/bicache/commit/ca2287df96839ceabd8282b41b5d6ca0ddd92d47
Faster FNV-1 32-bit https://github.com/jamiealquiza/bicache/commit/72f882470e1ff78521f0454b9bbbd413606c5a9b