Aloso / to-html

Utilities for making the colo documentation
MIT License
75 stars 10 forks source link

lazy-init should be a default feature #32

Closed jclulow closed 3 days ago

jclulow commented 2 weeks ago

The README suggests:

When the lazy-init feature is enabled, regexes are lazily initialized, which is more efficient if you want to convert A LOT of strings. The performance difference has not been tested.

I recently ran into a large performance-related regression as a result of our use of this crate. The lazy-init feature should be a default feature to avoid people having to discover this on their own!

slow

You can see in the flamegraph above that most of the on-CPU time in the server is spent recompiling the regular expression.

Aloso commented 2 weeks ago

Yes, let's enable it by default. Also, it still uses the once_cell crate, which is no longer needed since OnceLock is in the standard library.