todb/packetfu — pull request #9 by justfalter (2012-07-14 17:52:09+00:00)
Title: Significant performance improvements to PacketFu::Octets.

This is the first of two pull requests. In this pull request, I modified PacketFu::Octets to reduce it's reliance on IPAddr. My second pull request will include further improvements, but required refactoring Octets to use an Int32 rather than four Int8s

After profiling PacketFu, I found that a significant amount of time was spent in IPAddr, which to me seemed very unnecessary (at least for IPv4).

By removing the reliance on IPAddr for parsing to/from the Octets native form (as well as a few other tweaks), I've improved the performance for the following methods

Octets#read_quad : ~6x faster
Octets#to_x: ~8x faster
Octets#to_i: 20x faster
Octets#to_s: 1.5x faster