Closed Bug 1897079 Opened 2 years ago Closed 2 years ago

all_mozbuild_paths is too slow

Categories

(Firefox Build System :: General, enhancement)

enhancement

Tracking

(firefox128 fixed)

RESOLVED FIXED
128 Branch
Tracking Status
firefox128 --- fixed

People

(Reporter: alphare33, Assigned: alphare33)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:125.0) Gecko/20100101 Firefox/125.0

Steps to reproduce:

Run any command that scans for **/moz.build files like mach taskgraph morphed with a profiler (I used py-spy).

Actual results:

all_mozbuild_paths takes around 6s on a quite recent and fast machine (AMD Ryzen 9 7950X, Samsung SSD 980 PRO, plenty of fast RAM).

Expected results:

I expect this step to take a few hundreds of milliseconds on such a machine. Using fd 'moz.build' -E python/mozbuild/mozbuild/test -E testing/mozbase/moztest/tests/data -E 'obj*' -E '*/config.status', with fd being the fd-find Rust binary, I get around 300ms.

Unfortunately, from previous discussions with glandium and sergesanspaille, using Rust (for easy parallelization) in this instance is not possible since all_mozbuild_paths is used during an early enough stage of the build system that compiled extensions are not really an option.

However, a comment left in this function could be the solution :

# In the future, we may traverse moz.build files by looking
# for DIRS references in the AST, even if a directory is added behind
# a conditional. For now, just walk the filesystem.

This duplicates some of the logic w.r.t. ignore logic to prioritize speed.
Hopefully the tradeoff is acceptable.

Assignee: nobody → alphare33
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Pushed by jlorenzo@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/dc95deda78cc Improve speed of fs traversal in `all_mozbuild_paths`. r=glandium?sergesanspaille
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 128 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: