glossarist / iev-data

1 stars 1 forks source link

Re-use regular expressions when parsing IEV termlinks #147

Open skalee opened 3 years ago

skalee commented 3 years ago

Initializing regular expressions over and over again takes almost 20% of concept generation time, not mentioning additional work for the garbage collector. Some easy improvement to do here, I guess.

Zrzut ekranu 2021-03-15 o 11 39 35

skalee commented 3 years ago

Regular expressions in Ruby are generally immutable. I bet these two are root of all evil:

https://github.com/glossarist/iev-data/blob/4b2c0a957558bfed1e5153bf57dadde1352e471b/lib/iev/termbase/term_builder.rb#L396-L397

I suppose they can be generalized so that they don't include any particular IEV domain, and so that they don't need to be reinstantiated over and over again.