Closed Bug 1886124 Opened 7 months ago Closed 7 months ago

Indentation of generated binding code is broken

Categories

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

defect

Tracking

()

RESOLVED FIXED
126 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox124 --- unaffected
firefox125 --- fixed
firefox126 --- fixed

People

(Reporter: peterv, Assigned: sergesanspaille)

References

(Regression)

Details

(Keywords: regression)

Attachments

(2 files)

The patch's comment just says that 're.sub is overkill here', but it sure looks to me like the patch does change the behaviour of the indent() function to only indent the first line, as opposed to all the lines in the string.

Flags: needinfo?(sguelton)

According to ipython's %timeit:

>>> %timeit new_indent(a)
889 ns ± 5.54 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each)

>>> %timeit ref_indent(a)
2.65 µs ± 7.08 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each)

where ref_indent is the reference function, regexular-expression-based
new_indent is the one proposed in this patch

a is a small multiline string:

>>> a = """
... csrvrsvsr
...   csvfrz
... fvregvrg
... # frfger
...
... """

I've tested with

a = "errty" # small string

and

a = ("er" * 40 + '\n') * 100

and the split/join approach is always faster by a factor of at least 2.5

Assignee: nobody → sguelton
Status: NEW → ASSIGNED

My fault. I've submitted an updated patch and added you as a reviewer.

Flags: needinfo?(sguelton)

Set release status flags based on info from the regressing bug 1884319

Type: task → defect
Attachment #9392012 - Attachment description: Bug 1886124 - Fix regression on webidel indent while keeping part of the performance gain r=peterv → Bug 1886124 - Fix regression on webidl indent while keeping part of the performance gain r=peterv!
Pushed by sguelton@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/dbfd6042b4d2 Fix regression on webidl indent while keeping part of the performance gain r=peterv
Severity: -- → S4
Status: ASSIGNED → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → 126 Branch

The patch landed in nightly and beta is affected.
:sergesanspaille, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox125 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(sguelton)

wontfix: it's not affecting the behavior of firefox, just making the source less convenient to read.

Flags: needinfo?(sguelton)

(In reply to [:sergesanspaille] from comment #8)

wontfix: it's not affecting the behavior of firefox, just making the source less convenient to read.

It does affect looking at crashes inside binding code on beta and release. It doesn't come up all that often but it also looks like a low risk patch.

According to ipython's %timeit:

>>> %timeit new_indent(a)
889 ns ± 5.54 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each)

>>> %timeit ref_indent(a)
2.65 µs ± 7.08 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each)

where ref_indent is the reference function, regexular-expression-based
new_indent is the one proposed in this patch

a is a small multiline string:

>>> a = """
... csrvrsvsr
...   csvfrz
... fvregvrg
... # frfger
...
... """

I've tested with

a = "errty" # small string

and

a = ("er" * 40 + '\n') * 100

and the split/join approach is always faster by a factor of at least 2.5

Original Revision: https://phabricator.services.mozilla.com/D205061

Attachment #9393517 - Flags: approval-mozilla-beta?

Uplift Approval Request

  • User impact if declined: No direct impact. It will make understanding crashes inside generated binding code more difficult, which is not very common.
  • Risk associated with taking this patch: Low
  • Fix verified in Nightly: yes
  • String changes made/needed: none
  • Steps to reproduce for manual QE testing: none
  • Code covered by automated testing: yes
  • Explanation of risk level: It just changes indentation in generated bindings code.
  • Is Android affected?: yes
  • Needs manual QE test: no
Attachment #9393517 - Attachment description: Bug 1886124 - Fix regression on webidl indent while keeping part of the performance gain r=peterv! → Bug 1886124 - Fix regression on webidl indent while keeping part of the performance gain r=peterv

Uplift Approval Request

  • User impact if declined: No direct impact. It will make understanding crashes inside generated binding code more difficult, which is not very common.
  • Risk associated with taking this patch: Low
  • Needs manual QE test: no
  • Steps to reproduce for manual QE testing: none
  • Fix verified in Nightly: yes
  • Code covered by automated testing: yes
  • Explanation of risk level: It just changes indentation in generated bindings code.
  • Is Android affected?: yes
  • String changes made/needed: none
Attachment #9393517 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: