Closed Bug 1884321 Opened 8 months ago Closed 7 months ago

webidl.py profiling shows half a second spent looking up the `filename()` method

Categories

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

task

Tracking

()

RESOLVED FIXED
125 Branch
Tracking Status
firefox125 --- fixed

People

(Reporter: sergesanspaille, Assigned: sergesanspaille)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

In python, method calls are slower than attribute lookup, which can make a difference for repeatedly called methods that are actually attribute getter.

In [1]: class A:
   ...:     def __init__(self):
   ...:         self.var = 1
   ...: 

In [2]: class B:
   ...:     def __init__(self):
   ...:         self._var = 1
   ...:     def var(self):
   ...:         return self._var
   ...: 

In [3]: a = A()

In [4]: b = B()

In [5]: %timeit a.var
10.9 ns ± 0.457 ns per loop (mean ± std. dev. of 7 runs, 100,000,000 loops each)

In [6]: %timeit b.var()
28.7 ns ± 0.134 ns per loop (mean ± std. dev. of 7 runs, 10,000,000 loops each)

Pushed by sguelton@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3bc46d60be63 faster webildl.py: faster filename access r=ahochheiden
Blocks: 1646937
No longer blocks: 1884317
Pushed by sguelton@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d60b35180991 faster webildl.py: faster filename access r=ahochheiden
Status: NEW → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → 125 Branch
Regressions: 1885133
Component: General → DOM: Bindings (WebIDL)
Product: Firefox Build System → Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: