• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

dnsimple / dns_erlang / 30118985398
92%

Build:
DEFAULT BRANCH: main
Ran 24 Jul 2026 06:59PM UTC
Jobs 1
Files 12
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

24 Jul 2026 06:58PM UTC coverage: 88.446% (+0.004%) from 88.442%
30118985398

push

github

web-flow
Optimize dns_decode: fewer allocations and dispatches on the decode path (#135)

* Optimize dns_decode:decode_text/1 character-string parsing

Match <<Len, Str:Len/binary, Rest/binary>> directly instead of going
through decode_string/1, dropping one {Rest, Str} tuple allocation and
one call per character-string (TXT, SPF, HINFO, RESINFO, WALLET) and
letting the compiler delay sub-binary creation for the tail. Malformed
lengths still raise function_clause, which the RR decode loops surface
as formerr. decode_string/1 remains in use for NAPTR.

Decoding a TXT-heavy response (8 records x 4 strings) measures ~10%
fewer reductions and ~16% less allocation.

* Optimize dns_decode DNSKEY key tag computation

Fold four 16-bit words per iteration in do_bin_to_key_tag/2 instead of
one, quartering the loop iterations for the common key sizes. The
trailing clauses and the final carry fold are unchanged; the running
sum stays a small integer for any real key.

Decoding a DNSKEY response measures ~22% fewer reductions.

* Optimize dns_decode NSEC/NSEC3/CSYNC/NXT type bitmap decoding

Type bitmaps were decoded one bit at a time, costing a match-context
iteration per bit. They always arrive as whole-byte sub-binaries of the
message, so decode them a byte at a time instead: a zero byte is
skipped with a single dispatch, and a non-zero byte expands through
eight inlined integer band tests. NSEC and NXT now share the same
helper, and specs tighten from bitstring() to binary() to match what
dns_domain:from_wire/2 actually produces.

Decoding a response carrying 12 NSEC/NSEC3 records with realistic
multi-window bitmaps measures ~2x fewer reductions.

* Assemble the decoded dns_message record once in dns_decode

decode_body updated the #dns_message{} record once per section
(questions, answers, authority, additional), copying the full 19-word
record four times per message. The section lists now travel through
function arguments and the record is updated exactly once on
com... (continued)

24 of 26 new or added lines in 1 file covered. (92.31%)

2794 of 3159 relevant lines covered (88.45%)

10920.07 hits per line

Uncovered Changes

Lines Coverage ∆ File
2
91.67
0.04% src/dns_decode.erl
Jobs
ID Job ID Ran Files Coverage
1 30118985398.1 24 Jul 2026 06:59PM UTC 12
88.45
GitHub Action Run
Source Files on build 30118985398
  • Tree
  • List 12
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #30118985398
  • 0780b2eb on github
  • Prev Build on main (#30105223823)
  • Next Build on main (#30122560262)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc