jamesmontemagno / Censored

A .NET Profanity Censoring Library
MIT License
37 stars 6 forks source link

Perf: Don't create N Regex objects for each invocation #2

Open drewnoakes opened 8 years ago

drewnoakes commented 8 years ago

Regex objects can be cached and reused for better CPU/GC perf.

This line in particular:

https://github.com/jamesmontemagno/Censored/blob/master/Censored/Censored.cs#L45