Conversation
Your org has enabled the Graphite merge queue for merging into mainAdd the label “merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
|
@Boshen @overlookmotel what do you think? |
|
We can also have 2 types of traits for these to remove the |
CodSpeed Performance ReportMerging #3744 will improve performances by 7.62%Comparing Summary
Benchmarks breakdown
|
a343b03 to
ebc729b
Compare
|
I'm not sure about the following 3 PRs, let me hold onto this. I think it's fine to always run cfg in the linter:
I also think we should let it crash if cfg is not set, instead of enforcing it at compile time, which over complicates the code. |
a533fde to
6198181
Compare
|
My preference tends to be to use the type system to rule out impossible situations at compile time, rather than the risk of runtime panics (and the extra branching and ASM this involves). However, as Boshen says, type system stuff does have the downside of complicating the code. Probably I shouldn't have waded in on this question as I don't know the linter at all. I don't know how expensive constructing CFG is, or how common it is that all rules that require it would all be disabled. So I can't really assess the cost/benefit balance. |
I guess I should close these then right? Shall I create a PR and salvage some parts like the |
I also like the idea of depending on the type system instead of runtime checks especially if it can be a zero-cost abstraction. Makes code more clear in my opinion(for the new contributors/consumers, not the maintainers). But I have to agree with Boshen in regards to it being a bit overkill for our current needs.
It consumes about 2 to 3 percents so it isn't mostly about performance gain, It allows better feature gating though. There are a handful of CFG rules implemented and about a dozen or so in total (some aren't recommended and we might skip). |
|
Thanks for coming back with the background. I think I don't know enough of the linter at present to contribute more to this particular debate, so best I leave it to you and Boshen to decide what's best. Sorry my comment (which I'd meant as kind of out loud musing) has lead you "up the garden path". |
You don't have to be sorry; Even if you hadn't mentioned it I might've still ended up on this tangent, I love type "ejaculations" so this experiment was a fun ride for me😆 |

related to this conversation #3737 (comment)
Adds a
use_cfgattribute to use withdeclare_oxc_lintmacro. When this attribute is used it would set the rule'sRuleMeta::USE_CFGconstant to true.Since with this information, we can figure out whether a set of rules uses control flow or not we can use this information to provide a
LintContext::cfgmethod that would panic if called and cfg doesn't exist.Basically in the context of a rule, the linter should make sure the rule which requests control flow generation always gets it.