Making DNS_Erlang Fast: Binary Tricks for the Beam
Comments
Ranked by a public rubric, not by votes: what a comment adds counts, not who wrote it. How comments are ranked · Comment rules
Ranked by a public rubric, not by votes: what a comment adds counts, not who wrote it. How comments are ranked · Comment rules
Summary
DNSimple rewrote the hot paths of dns_erlang, the Erlang DNS library behind its erldns name server, using only BEAM-level binary techniques, with no NIFs. The changes include one append-only encoder accumulator, decoding that stays in the match context, and 56-bit SWAR guards. On a replay of about 19 million production-shaped queries, CPU per query fell 12% and saturation throughput rose 14%. These figures are self-reported and the intermediate benchmarks are unverified. Some earlier optimizations had no end-to-end effect.