jsakamoto / ipaddressrange

.NET Class Library for range of IP address, both IPv4 and IPv6.
Mozilla Public License 2.0
368 stars 71 forks source link

Optimize IP comparison #40

Closed Menur closed 6 years ago

Menur commented 6 years ago

38 has some ideas to speed up library.

Implemented ideas:

Gained performance

Tests IPv4 range parse

IPv6 range parse:

IPv6 Contains - called both LE and GE

IPv4 Contains - called both LE and GE

IPv4 mapped to IPv6 Contains - called both LE and GE

Not implemented:

  1. I'm not fully sure it's a good idea.
  2. Get hash code takes for IPv4 as the most significant byte the last octet. 1.0.0.255 > 1.0.1.0
jsakamoto commented 6 years ago

Thank you for your contribution!

I'll merge this pull request due to I completed reviewing this pull request.

By the way, this pull request include the changes below:

Therefore, I'll merge this pull request manually with a few steps for keeping backward compatible.
So, for this work, please give me more few days.