kazu-yamamoto / iproute

IP Routing Table in Haskell
http://www.mew.org/~kazu/proj/iproute/
BSD 3-Clause "New" or "Revised" License
47 stars 28 forks source link

BoundedPrim ByteString Builders for IP addresses #46

Closed vdukhovni closed 4 years ago

vdukhovni commented 4 years ago
ipBuilder :: IP -> Builder
ipv4Builder :: IPv4 -> Builder
ipv6Builder :: IPv6 -> Builder

BoundedPrim builders fuse under 'mappend' with adjacent BoundedPrim Builders, reducing buffer bounds-check overhead, but most of the performance gain is derived from internal use of the PrimBounded machinery while building a single IPv6 address.

Streaming 50 million IPv6 addresses to stdout (~3.07 seconds on my machine) outperforms typical C-library inet_ntop() (~30.5s) by a factor of 10!

vdukhovni commented 4 years ago

Before, this is merged, I'd like to squash the commits, please let me know when I should do that.

kazu-yamamoto commented 4 years ago

Please squash right now and do push -f.

vdukhovni commented 4 years ago

Please squash right now and do push -f.

Done.

vdukhovni commented 4 years ago

I am inclined one mostly cosmetic simplification, coming up...

kazu-yamamoto commented 4 years ago

Merge. Thank you for your contribution!

A new version has been released.

vdukhovni commented 4 years ago

I see you already merged it. I'll open a new PR.