-
Notifications
You must be signed in to change notification settings - Fork 745
Warn about unused whitelist options #1469
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks reasonable to me, but have you done any perf measurements?
This can generally slow down whitelisting and such, since now you need to match every regex instead of stopping at the first that matches.
If not, it may be worth putting this behind a flag, specially given this is mostly a developer-oriented function. I could see this creating spurious warnings if a header on a given platform differs, which would be unfortunate.
Now I measured performance on internal codebase and I couldn't detect any change, but maybe our use cases are too small. Benchmark suggestions are welcome.
|
How many regexes are you using in your codebase? In Gecko we use quite a lot of them, see all the lists in: https://searchfox.org/mozilla-central/source/layout/style/ServoBindings.toml I still think a configuration option for this would be useful, because it wouldn't be great to spam other developers about warnings that they don't know how to fix, or platform-dependent stuff. It'd be great if you could do that but otherwise let me know and I'll try to take some time to make it happen as a followup to this PR before the next release. |
I already gave how many regexes we use. My understanding of RegexSet implementation is that slowdown happens only if multiple regexes actually match, and that doesn't seem to happen in Gecko, and I expect such cases to be rare. I think it is very desirable to have this on by default, like Rust's unused warnings. I expect it won't be used in practice if it is not on by default. If it isn't too much trouble, can you run the benchmark for Gecko's use case? I am uninterested in putting this behind a flag, so I appreciate your offer of a followup. Thanks. |
Alright, this works for now, sorry for the lag (Christmas). Will followup with the option, thank you for the patch! I agree this is useful :) |
Allow to turn off the matches recording introduced in #1469.
I welcome suggestions on better ways to report warnings.
cc #1055