morfologik / morfologik-stemming

Tools for finite state automata construction and dictionary-based morphological dictionaries. Includes Polish stemming dictionary.
BSD 3-Clause "New" or "Revised" License
186 stars 44 forks source link

micro performance optimization #97

Closed danielnaber closed 6 years ago

danielnaber commented 6 years ago

areEqual() runs containsKey() and then get(), I think it's faster by running get() directly? I found that areEqual takes 7% of all the CPU usage on languagetool.org, so any optimization there is welcome.

dweiss commented 6 years ago

This should have been eliminated by hotspot and make no practical difference, actually -- I am a bit surprised it increases performance. But I like the patch nonetheless.

danielnaber commented 6 years ago

Just to be clear, I didn't actually measure if there's any improvement, I just found this by looking at the code and thought it cannot do any harm.

dweiss commented 6 years ago

Oh, ok. Thanks anyway!