-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] FeatureFlags.isEnabled
is kinda slow
#16519
Comments
A comment was added as part of #4959 suggesting that we remove that I think we may need to fix |
I think |
Yeah, that makes sense. We can clear the flags in |
This seems interesting, can I take this up? |
In the Open Source world the answer is almost always, universally, an all-caps-shouted YES! Assigning to you! |
[Search Triage] @bhngupta Hi, were you able to get started on this? |
Taking a look at this. |
Describe the bug
After having run the full
big5
benchmark to create the index, I ran the following command to isolate a simple query and run it as fast as possible:This is a super fast query, so I was specifically looking for overhead in things not related to doing heavyweight search work. It turns out
FeatureFlags.isEnabled
is taking almost 5% of CPU cycles. It is unsurprising that a feature flag check might pop up in hot path code, and there's no reason that looking up a setting value should be so expensive. It turns out theSystem.getProperty
check is kind of slow (because of a security manager check it seems).Related component
Search
To Reproduce
See above
Expected behavior
Features flags defined in system properties are not dynamic. All feature flags are statically known. We should pre-populate these booleans into an immutable map during static initialization to avoid the
System.getProperty
call at runtime.Additional Details
The text was updated successfully, but these errors were encountered: