Closed ThatCoolCoder closed 1 year ago
This is going to need a little more thought on my part, regexes often aren't the most performant things, and I've managed to avoid them so far.
Ok, that's fair enough - I haven't tested the performance of this but I figured that a regex would have less of a performance impact than some sort of linq-based thing checking each character individually.
It does vary, for certain kinds of operations, especially on .net 7, linq can be very fast thanks to hardware acceleration (vector instructions). And helper functions like char.IsDigit etc exist. Also, might be able to optimize more if we can use ReadOnlySpan
I believe this fixes #30, although I haven't written tests for the new behavior (I couldn't figure out where would be most appropriate) and it probably needs a little bit of looking at.
I'm not sure why it's showing the additions of the IEnumerator stuff since the commit history shows that it was already in the code as of 729f57bb51eb973f7c3f534d56d6c4ace29e2fd7, which was what I forked from.