juliangruber / balanced-match

Match balanced character pairs, like { and }
MIT License
125 stars 40 forks source link

Skip over slicing #12

Closed jamen closed 8 years ago

jamen commented 8 years ago

I'm creating a very lightweight module that can potentially run several millions of times per second.

Right now, I don't use this module because it slices the data automatically... But I would like to use this module because of it's efficient balanced matching.

When you slice the data over and over millions of times when I don't need it, the nanosecond tasks start adding up into several hundreds of millisecond delays, and possibly even seconds.

For my module, I am purely interested in the positions of the matches... I can develop my own highly efficient slicing pattern specific to the data instead of this module doing it automatically when it is not what I need.

juliangruber commented 8 years ago

we can def. disable slicing via an option. mind making a pull request?

neytema commented 8 years ago

balanced.range(a, b, str)

jamen commented 8 years ago

Thank you, I had saw it in the source code, guess I did not see it exporting.

juliangruber commented 8 years ago

ha, thank you @neytema, knowing my module better than me :)

juliangruber commented 8 years ago

i guess this just shows that for a collaboratively improved open source module the initial author doesn't matter as much