kazu-yamamoto / dnsext

Extensible DNS libraries written purely in Haskell
59 stars 3 forks source link

fromBase32Hex fusion loop #147

Closed khibino closed 1 year ago

khibino commented 1 year ago

An issue raised in https://github.com/kazu-yamamoto/dnsext/issues/145#issuecomment-1751926230

Applying fusion loop to reduce allocation during decoding base32hex.

A comparison of before and after profile results is below.


before applying:

COST CENTRE           MODULE                      SRC                                          %time %alloc

fromBase32Hex         DNS.Types.Opaque.Internal   DNS/Types/Opaque/Internal.hs:60:1-58           2.3    6.2

after applying:

COST CENTRE           MODULE                      SRC                                          %time %alloc

fromBase32Hex         DNS.Types.Opaque.Internal   DNS/Types/Opaque/Internal.hs:60:1-42           0.3    1.3