kschiess / parslet

A small PEG based parser library. See the Hacking page in the Wiki as well.
kschiess.github.com/parslet
MIT License
809 stars 95 forks source link

Reduce memory allocations #162

Closed cbliard closed 8 years ago

cbliard commented 8 years ago

Parslet::Pattern allocates 3 to 4 arrays just to do comparisons each time #element_match is called.

This little patch avoids these allocations.

In one of our usecase we saw memory allocated by parslet gem going from 440 to 336 MiB (-25%) using memory-profiler gem to measure it.