Open
Bug 1890491
Opened 6 months ago
Updated 6 months ago
Speedup moz.build parsing
Categories
(Firefox Build System :: General, task)
Firefox Build System
General
Tracking
(Not tracked)
NEW
People
(Reporter: sergesanspaille, Assigned: sergesanspaille)
References
(Blocks 1 open bug)
Details
We spend several seconds in the configure step executing the moz.build
files. It's worth checking if we could do that in a faster way.
Assignee | ||
Comment 1•6 months ago
|
||
On possible approach, based on this session:
ssp@lakota:/tmp/py% cat fun.py
def foo(x, y, z):
x += [1]
y = "foo"
if z:
x += [z]
y += "bar"
return x, y, z
ssp@lakota:/tmp/py% cat g.py
x += [1]
y = "foo"
if z:
x += [z]
y += "bar"
ssp@lakota:/tmp/py% python -m timeit -s 'x = []; y = ""; z = 1; from fun import foo as fun' 'x, y, z = fun(x, y, z)'
1000000 loops, best of 5: 207 nsec per loop
ssp@lakota:/tmp/py% python -m timeit -s 'x = []; y = ""; z = 1; obj = compile(open("g.py").read(), "<>", "exec")' 'exec(obj)'
500000 loops, best of 5: 752 nsec per loop
would be to automatically turn moz.build
files into functions, so that we can benefit from faster variable access for function local variables instead of global variables.
Assignee | ||
Comment 2•6 months ago
|
||
extra data point, with a scenario that would be closer to reality:
ssp@lakota:/tmp/py% python -m timeit -s 'x = []; y = ""; z = 1; obj = compile(open("fun.py").read(), "<>", "exec"); d={}' 'x, y, z = (exec(obj, d), d["foo"](x, y, z))[1]'
500000 loops, best of 5: 442 nsec per loop
You need to log in
before you can comment on or make changes to this bug.
Description
•