Open Bug 1853235 Opened 10 months ago Updated 10 months ago

Avoid repeated null checks and mIsAnyMemberPresent assignments in dictionary initializers (e.g. EventModifierInit::Init)

Categories

(Core :: DOM: Bindings (WebIDL), enhancement)

enhancement

Tracking

()

People

(Reporter: mstange, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [sp3])

Here's the generated code for EventModifierInit::Init: https://searchfox.org/mozilla-central/source/__GENERATED__/dom/bindings/UIEventBinding.cpp#253

You can see that it has lots of repeated if (!isNull) { ... } checks and mIsAnyMemberPresent = true; assignments.

In the profile in bug 1851236, some samples are associated with those mIsAnyMemberPresent lines, so it seems that the repeated assignments are not optimized out, and probably the isNull checks aren't either.

It may improve things a tiny bit if we tightened this up a bit. For example, if we only have one mIsAnyMemberPresent = true; assignment after the first property, then the remaining individual isNull checks will probably get folded into one check by the compiler.

Whiteboard: [sp3]
You need to log in before you can comment on or make changes to this bug.