Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Compile regex pattern for MetricFilter only once #2637
Noticed a static regex getting compiled 60 times per second on my system. Modified implementation so that it gets compiled only once. Also moved the anonymous class outside run() so that further tests are easier to implement.
Motivation and Context
This tiny change frees whopping ~1 millisecond of CPU time every second for actual message processing duties.
How Has This Been Tested?
Added a unit test for positive test case.
Screenshots (if appropriate):
Types of changes