devicemanager.pushDir is very inefficient

RESOLVED WONTFIX

Status

Testing
General
RESOLVED WONTFIX
5 years ago
a year ago

People

(Reporter: gbrown, Assigned: gbrown)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Assignee)

Description

5 years ago
The devicemanager pushDir command appears to be inefficient.

A quick inspection of the devicemanagerSUT implementation shows that for each file in the local directory, pushFile is called. pushFile calls dirExists to determine if the to-be-pushed entity is an existing directory, and dirExists is implemented as 2 sut commands: cd and cwd. Further, pushFile may call mkDirs, which also calls dirExists. As a result, when pushing a directory, there is all this extra traffic between the dm and the device, checking and re-checking which directories exist. This seems unnecessary: pushFile should be able to simply attempt to push the file to the device, and the device should be able to determine which directories exist and which need to be created.

I see these possibilities for optimization:
 - eliminate calls from mkDirs to dirExists
 - eliminate calls from pushFile to dirExists
 - eliminate calls from pushFile to mkDirs
 - implement dirExists as a single sut command

There may be similar optimizations available for devicemanagerADB.
(Assignee)

Comment 1

5 years ago
A complication:

dmSUT.pushFile calls validateFile before attempting to push: If the remote file exists and has the same hash as the local file, pushFile is done. This seems like a reasonable optimization and convenience feature, which allows pushFile to succeed when the destination file exists, without pushFile being destructive. validateFile requires a remote call to get the destination file hash. Furthermore, validateFile needs to have the exact remote file name -- but the remote file name is dependent on whether or not the destination argument passed to pushFile is a remote directory, or a remote file.

All of this per-push remote access can still be eliminated (I think!) but it will take some work...
(Assignee)

Comment 2

5 years ago
(In reply to Geoff Brown [:gbrown] from comment #0)
> There may be similar optimizations available for devicemanagerADB.

See bug 810546.
(Assignee)

Updated

5 years ago
See Also: → bug 797897
(Assignee)

Updated

5 years ago
See Also: → bug 814767
(Assignee)

Comment 3

5 years ago
Run time for large pushDir's is much better now than it was when this bug was opened. There are ideas in Comment 0 that could be pursued for greater efficiency, but this is certainly not a high priority now.
Assignee: gbrown → nobody
(Assignee)

Comment 4

a year ago
Most of the ideas in Comment 0 apply to sutagent -- no longer important. Current adb pushDir is pretty efficient.
Assignee: nobody → gbrown
Status: NEW → RESOLVED
Last Resolved: a year ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.