Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing performance #9

Open
yahorsi opened this issue Apr 9, 2015 · 3 comments
Open

Parsing performance #9

yahorsi opened this issue Apr 9, 2015 · 3 comments

Comments

@yahorsi
Copy link

yahorsi commented Apr 9, 2015

Hi, thanks for the great lib, the ONLY for the ranges!!! Really really useful.

The IP ranges mught be used on some really hot paths in the app, so, did you ever consider replacing Regex.Match with something more robust & fast?

@jsakamoto
Copy link
Owner

I feel it is good idea about improvement to more faster parsing IP range text, I agree.

But I don't have enough my resouce (my private time), and more important point, I have no skill to how to coding more faster parsing 😭

Could you improve this issue and send me pull request?
Or can you find anybody to improve this issue?

P.S.
I have already Unit Test suite, so these refactoring can feel free to apply, and safety :)

@gregmac
Copy link
Contributor

gregmac commented Jun 3, 2015

Regex is very fast, and the use of regex here I'd say is appropriate. It could be made slightly faster, in some cases, by declaring static regex properties rather than in-line parameters, but even as-is, the compiled regular expressions are cached. Good reference about this: [https://msdn.microsoft.com/en-us/library/gg578045%28v=vs.110%29.aspx](Best Practices for Regular Expressions in the .NET Framework).

Now, if you're suggesting something other than regex, my gut reaction is that it's the wrong way to go. There are a wide range of inputs, so anything that can handle all of them is going to be complex, and complex flow is hard to make robust.

That said, the way forward is to make a pull request and include some comparative benchmarks showing the improvement. :)

@llCorvinSll
Copy link
Contributor

for example, IPAddress class use native system calls for parsing IPs, but for quick googling dont tell me

  1. native method for network
  2. this solution is hard to implement and make cross-platform

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants