Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Looking at Aiken's repositories in the wild, no one is using Dict with anything else than ByteArray as key. The extra complexity we bring just for making it generic in the key argument seems not worth it. Plus, if we know the key is a ByteArray, we can perform some optimizations on a few functions looking for keys to short-circuit them instead of traversing a list entirely. Here's a comparison of the mem and cpu cost before and after the chance for a few tests (omitted tests have identical cost). | mem | cpu | bench | | --- | --- | --- | | -10.15% | -5.88% | delete_3 | | -4.00% | -9.68% | delete_4 | | -3.80% | -9.39% | delete_5 | | -31.03% | -42.88% | delete_6 | | -15.26% | -26.34% | find_4 | | -11.10% | -18.85% | from_list_2 | | -8.02% | -16.26% | from_list_3 | | -12.15% | -25.39% | from_list_4 | | -19.24% | -36.11% | bench_from_list | | -17.79% | -18.91% | bench_from_ascending_list | | -4.91% | -10.58% | get_2 | | -9.49% | -14.63% | get_3 | | -29.94% | -42.75% | get_4 | | -23.66% | -37.70% | get_5 | | -7.94% | -5.03% | has_key_3 | | -9.97% | -18.50% | has_key_4 | | -16.46% | -23.61% | insert_1 | | -16.52% | -26.24% | insert_2 | | -13.82% | -22.08% | insert_with_1 | | -18.77% | -29.88% | insert_with_2 | | -19.12% | -30.52% | insert_with_3 | | -10.47% | -17.40% | keys_2 | | 4.25% | 5.06% | map_1 | | 2.94% | 3.31% | map_2 | | -10.99% | -19.83% | size_3 | | -7.94% | -16.17% | union_1 | | -17.74% | -28.17% | union_3 | | -16.96% | -26.55% | union_4 | | -15.91% | -25.10% | union_with_1 | | -10.47% | -17.39% | values_2 |
- Loading branch information