BeRo1985 / flre

FLRE - Fast Light Regular Expressions - A fast light regular expression library
GNU Lesser General Public License v2.1
94 stars 23 forks source link

slow parsing due to freeing nodes #29

Open benibela opened 8 years ago

benibela commented 8 years ago

When I run my unit tests (till valgrind aborts), 2/3 of the time is spend in parsing regexps, because it calls tlist.indexOf, which is slow. Can you use a hashmap?

flre

benibela commented 8 years ago

If you look at the picture, you see indexOf is called over a million times, yet freenodes calls it only 90 000 times.

The other 900 000 calls are in optimzeNodes. Seems the list there is much smaller, as those calls are much faster, being negligible for the time (133 million lr). Still optimizeNodes is among the most costly functions. For some reason it calls TList.create 200 000 times

benibela commented 8 years ago

Also, TList...

There is no reason to use TList with fpc. It is just a wrapper around TFPList. TFPList is preferable, unless you need event handling