-
Notifications
You must be signed in to change notification settings - Fork 9
Update toolchain #11
base: main
Are you sure you want to change the base?
Update toolchain #11
Conversation
* update an incomplete type spec for khash:del/2 * use assertEqual instead of assertMatch to silence a spurious warning * khash:keys/1 was never implemented; use khash:fold/3 in the test suite instead and enable the missing test
1134d86 to
460c5e1
Compare
|
A thought I had is that we had created khash before maps were available. With optimized maps available since OTP 18, does khash still perform better than maps? Perhaps the easiest here might be to switch to maps and have one less C dependency. |
|
Oh, good idea! Better to not need the extra code at all. |
|
I wrote a short Escript to benchmark khash against Erlang maps and attached it to this PR. It's not my finest demonstration of scientific rigor, but it does provide some guidance. General observations:
Larger datasets exhibit a fair amount of noise; I expect this is largely due to garbage collection. Using maps instead of khash instances inside e.g. the On the topic of LRUs, I noticed that we have different implements for the authentication cache ( |
|
I was thinking about this a bit more in between various college football games today and remembered the obvious answer for large maps: just use ETS. I also went back and reviewed the two places where we are using The other current use case is in the
That second mapping showcases a nice property of the khash NIF, namely that nesting the hashes allows one to update a "leaf" hash without needing to update the parent hash. Nested maps would have rather different runtime characteristics. Given that I wouldn't feel confident about refactoring |
Following the pattern from b64url