more useful options | |
PerlMonks |
Re: RFC: Sorting IPv4 addressesby ikegami (Patriarch) |
on Oct 06, 2009 at 22:42 UTC ( [id://799607]=note: print w/replies, xml ) | Need Help?? |
In practice, you often need the IP address in packed form anyway, so there's work reuse. That makes the solutions that pack that much more efficient. If not, the following would be even faster
Where unpack_ipv4s and pack_ipv4s are efficient XS functions. Of course, it would be even faster if you rewrote the sorter to work with numbers directly instead of handling SVs containing numbers. It's curious that you only used unpack 'N' in combination with split and that you never tried split without unpack 'N'.
In Section
Meditations
|
|