Closed Bug 814767 Opened 12 years ago Closed 12 years ago

devicemanager: mkDirs optimization

Categories

(Testing :: General, defect)

x86
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: gbrown, Assigned: gbrown)

Details

Attachments

(1 file, 1 obsolete file)

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.
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 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+
Updated for review comments: removed 3 pairs of ()s. r=wlach
Attachment #684774 - Attachment is obsolete: true
Attachment #685893 - Flags: review+
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.

Attachment

General

Created:
Updated:
Size: