Closed
Bug 814767
Opened 12 years ago
Closed 12 years ago
devicemanager: mkDirs optimization
Categories
(Testing :: General, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: gbrown, Assigned: gbrown)
Details
Attachments
(1 file, 1 obsolete file)
1.54 KB,
patch
|
gbrown
:
review+
|
Details | Diff | Splinter Review |
mkDirs() is a commonly used devicemanager function. Note particularly that it is called on every pushFile(). mkDirs() calls mkDir() for each component of the requested directory, and mkDir() first calls dirExists() to determine if that directory needs to be created.
For example, pushFile("/a/b/c/d/e"), when a/b/c/d exists, results in something like:
isdir a
isdir a/b
isdir a/b/c
isdir a/b/c/d
push a/b/c/d/e
We can easily reduce this case to:
isdir a/b/c/d
push a/b/c/d/e
If the directory does not exist, we can fall back to the current procedure.
Assignee | ||
Comment 1•12 years ago
|
||
Assignee | ||
Comment 2•12 years ago
|
||
Try run is okay: https://tbpl.mozilla.org/?tree=Try&rev=35e21866f633
Assignee | ||
Comment 3•12 years ago
|
||
Comment on attachment 684774 [details] [diff] [review]
in mkDirs, check for dir existence up front
This is not a big win, but it is simple and reduces dm <-> sut traffic a little.
Attachment #684774 -
Flags: review?(wlachance)
Comment 4•12 years ago
|
||
Comment on attachment 684774 [details] [diff] [review]
in mkDirs, check for dir existence up front
This looks ok to me. I would prefer if you didn't use parantheses on the if statements, as that's the style we've decided to use elsewhere in this file. e.g.:
e.g. replace if (not self.dirExists(dirParts[0])):
with:
if not self.dirExists(dirParts[0]):
I know there's two places elsewhere in this function which use that style. Feel free to fix those as well.
Attachment #684774 -
Flags: review?(wlachance) → review+
Assignee | ||
Comment 5•12 years ago
|
||
Updated for review comments: removed 3 pairs of ()s. r=wlach
Attachment #684774 -
Attachment is obsolete: true
Attachment #685893 -
Flags: review+
Comment 6•12 years ago
|
||
Pushed to mozbase: https://github.com/mozilla/mozbase/commit/5254c121d85ed17339985fec6f134c73f64d0583
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•