stchang / parsack

A basic Parsec-like monadic parser combinator library implementation in Racket.
MIT License
50 stars 10 forks source link

Make oneOf and noneOf about 3X faster #41

Closed greghendershott closed 10 years ago

stchang commented 10 years ago

thanks!

greghendershott commented 10 years ago

Thanks for merging. Re what I mentioned on IRC, it turns out I got the benchmark down to ~900 msec due to a bug (i.e. I am an idiot). However after fixing that, it is down to ~2000, so far, which is still pretty good. This change helps with that.

stchang commented 10 years ago

I had also discovered that curry was slow, but interestingly it didn't speed up your perf-test.rkt so I didn't mention it.

I also tried using unsafe string ops but it didn't help either. Could be the compiler is already using them.

stchang commented 10 years ago

50% speedup is still pretty good!

greghendershott commented 10 years ago

True. Also I got it from ~2000 to ~1500 with some more common-prefix refactoring.

Maybe with a few more gains like that, I could get it close to my fake ~900, after all. :)