Skip to content

v0.2.1

Latest

Choose a tag to compare

@thatsme thatsme released this 06 Aug 13:21

No behaviour change. Slot assignment is identical to 0.2.0 and 0.1.0, which test/fixtures/golden_0_1_0.txt asserts on every run against digests taken from the 0.1.0 package as published.

This is the first release to reach Hex since 0.1.0. v0.2.0 was tagged but never published; everything in it is included here.

Fixed

  • The golden fixture is declared as an @external_resource, so regenerating it recompiles the tests that read it. Without that, a regenerated fixture left the previous digests compiled into the test module and the suite passed while checking nothing — invisible on CI, which always compiles from clean, and visible only on the local run immediately after regenerating.

Documentation

  • Tables are compared with Maglev.slots/1 rather than with ==. A table records how it was built as well as what it decided, so two tables that route every key identically can compare unequal across a release that changes which fill strategy a given weight distribution selects. Deciding whether to publish a rebuild by comparing structs would occasionally trigger a :persistent_term write, and its global collection scan, for a table that routes exactly as the one it replaces.

Included from 0.2.0

  • Lopsided weights build faster. A second fill strategy holds the turn order in a priority queue keyed on each backend's next eligible iteration, so backends not yet eligible to claim a slot are never visited. At 1000 backends and a 65537-slot table, one backend weighted 10000 against the rest at 1 builds in 59 ms rather than 1395 ms, while evenly weighted sets keep their previous cost. The strategy is selected from the weights, and both produce identical tables.
  • A golden fixture pinning slot assignment to the 0.1.0 package. Forcing every pinned configuration through the priority queue reproduces 0.1.0 exactly, including 1000 backends at 655373 slots with a weight ratio of 10000 — well beyond the range the properties generate.
  • Which hash functions are used, and that tables built here match no other Maglev implementation.
  • lookup_index/2 applies no mixing, so a narrow or skewed hash leaves slots unreachable or unevenly loaded.
  • Consistent worker assignment, which is the more common use on the BEAM than packet routing.
  • :persistent_term rebuild frequency in minutes or hours rather than seconds.

See the CHANGELOG for the full list.