Closed Bug 1641073 Opened 5 years ago Closed 5 years ago

mozpack: copying files uses inefficient string concatenation

Categories

(Firefox Build System :: General, enhancement)

enhancement

Tracking

(firefox78 fixed)

RESOLVED FIXED
mozilla78
Tracking Status
firefox78 --- fixed

People

(Reporter: mhentges, Assigned: mhentges)

Details

Attachments

(1 file)

When toolkit/mozilla/installer/unpack.py is invoked with python3 instead of python2, it takes ~60s instead of < 1s. This turns out to be because mozpack's BaseFile.copy() method is slow for large files.

The culprit of this performance issue is that string concatenation is slow since strings are immutable, and we are appending very large strings for large files.

Arrays are mutable, so appending each substring at a time and joining at the endis much faster than re-allocating
a new string on each loop.

Assignee: nobody → mhentges
Status: NEW → ASSIGNED
Pushed by mhentges@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/8a881029b6f9 improve BaseFile.copy() performance r=rstewart
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla78
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: