Closed Bug 791919 Opened 12 years ago Closed 8 years ago

devicemanager.pushDir is very inefficient

Categories

(Testing :: General, defect)

x86
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: gbrown, Assigned: gbrown)

References

Details

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.
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...
(In reply to Geoff Brown [:gbrown] from comment #0)
> There may be similar optimizations available for devicemanagerADB.

See bug 810546.
See Also: → 797897
See Also: → 814767
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
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
Closed: 8 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.