|
|
Created:
3 years, 8 months ago by tetsui2 Modified:
3 years, 8 months ago Reviewers:
fukino CC:
chromium-reviews, oka+watch_chromium.org, rginda+watch_chromium.org, mtomasz+watch_chromium.org, yamaguchi+watch_chromium.org, fukino+watch_chromium.org Target Ref:
refs/heads/master Project:
chromium Visibility:
Public. |
DescriptionReuse File objects in FileTransferController.
FileEntry.file is slow operation internally queries file metadata.
However, FileTransferController calls FileEntry.file for all the
selected files each time CHANGE_THROTTLED event is fired.
CHANGE_THROTTLED is fired every time a file is copied
during multi file copy.
In some slow storage devices which do not support parallel requests
such as MTP connected ones, this severely slows down file copy.
BUG=712121
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation
Review-Url: https://codereview.chromium.org/2843683002
Cr-Commit-Position: refs/heads/master@{#467270}
Committed: https://chromium.googlesource.com/chromium/src/+/3cba6ce1c4b98fb56f02556984813be8697b7729
Patch Set 1 #
Total comments: 4
Patch Set 2 : Remove file objects if not in the selection. #Patch Set 3 : Fix error. #
Total comments: 2
Patch Set 4 : Move file object deletion to the throttled. #Messages
Total messages: 23 (13 generated)
Description was changed from ========== Reuse File objects in FileTransferController. FileEntry.file is slow operation internally queries file metadata. However, FileTransferController calls FileEntry.file for all the selected files each time CHANGE_THROTTLED event is fired. CHANGE_THROTTLED is fired every time a file is copied during multi file copy. In some slow storage devices which do not support parallel requests such as MTP connected ones, this severely slows down file copy. BUG=712121 ========== to ========== Reuse File objects in FileTransferController. FileEntry.file is slow operation internally queries file metadata. However, FileTransferController calls FileEntry.file for all the selected files each time CHANGE_THROTTLED event is fired. CHANGE_THROTTLED is fired every time a file is copied during multi file copy. In some slow storage devices which do not support parallel requests such as MTP connected ones, this severely slows down file copy. BUG=712121 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ==========
The CQ bit was checked by tetsui@google.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
tetsui@google.com changed reviewers: + fukino@chromium.org
Please take a look.
Thanks! https://codereview.chromium.org/2843683002/diff/1/ui/file_manager/file_manage... File ui/file_manager/file_manager/foreground/js/file_transfer_controller.js (left): https://codereview.chromium.org/2843683002/diff/1/ui/file_manager/file_manage... ui/file_manager/file_manager/foreground/js/file_transfer_controller.js:1264: this.selectedAsyncData_ = {}; We should clear objects in selectedAsyncData_ if they are not selected.
https://codereview.chromium.org/2843683002/diff/1/ui/file_manager/file_manage... File ui/file_manager/file_manager/foreground/js/file_transfer_controller.js (left): https://codereview.chromium.org/2843683002/diff/1/ui/file_manager/file_manage... ui/file_manager/file_manager/foreground/js/file_transfer_controller.js:1264: this.selectedAsyncData_ = {}; On 2017/04/26 03:11:33, fukino wrote: > We should clear objects in selectedAsyncData_ if they are not selected. Every time a file is copied, both onFileSelectionChanged_ and onFileSelectionChangedThrottled are called. Therefore, setting {} here means clearing and creating all the File objects for the selected files every time, which leads to O(N^2) File object creation. File object creation requests metadata internally, therefore it is heavy operation on MTP. I'm not sure what would happen if a file is changed after the File object is created and then copied. Besides that, I think not clearing selectedAsyncData_ here is correct.
https://codereview.chromium.org/2843683002/diff/1/ui/file_manager/file_manage... File ui/file_manager/file_manager/foreground/js/file_transfer_controller.js (left): https://codereview.chromium.org/2843683002/diff/1/ui/file_manager/file_manage... ui/file_manager/file_manager/foreground/js/file_transfer_controller.js:1264: this.selectedAsyncData_ = {}; On 2017/04/26 03:37:04, tetsui wrote: > On 2017/04/26 03:11:33, fukino wrote: > > We should clear objects in selectedAsyncData_ if they are not selected. > > Every time a file is copied, both onFileSelectionChanged_ and > onFileSelectionChangedThrottled are called. Therefore, setting {} here means > clearing and creating all the File objects for the selected files every time, > which leads to O(N^2) File object creation. File object creation requests > metadata internally, therefore it is heavy operation on MTP. > > I'm not sure what would happen if a file is changed after the File object is > created and then copied. Besides that, I think not clearing selectedAsyncData_ > here is correct. I didn't mean that we should clear the selectedAsyncData_. By referring this.selectionHandler_.selection.entries, metadata for entries which are not in selection anymore should be removed. Does this make sense?
https://codereview.chromium.org/2843683002/diff/1/ui/file_manager/file_manage... File ui/file_manager/file_manager/foreground/js/file_transfer_controller.js (left): https://codereview.chromium.org/2843683002/diff/1/ui/file_manager/file_manage... ui/file_manager/file_manager/foreground/js/file_transfer_controller.js:1264: this.selectedAsyncData_ = {}; On 2017/04/26 03:49:17, fukino wrote: > On 2017/04/26 03:37:04, tetsui wrote: > > On 2017/04/26 03:11:33, fukino wrote: > > > We should clear objects in selectedAsyncData_ if they are not selected. > > > > Every time a file is copied, both onFileSelectionChanged_ and > > onFileSelectionChangedThrottled are called. Therefore, setting {} here means > > clearing and creating all the File objects for the selected files every time, > > which leads to O(N^2) File object creation. File object creation requests > > metadata internally, therefore it is heavy operation on MTP. > > > > I'm not sure what would happen if a file is changed after the File object is > > created and then copied. Besides that, I think not clearing selectedAsyncData_ > > here is correct. > > I didn't mean that we should clear the selectedAsyncData_. > By referring this.selectionHandler_.selection.entries, metadata for entries > which are not in selection anymore should be removed. > Does this make sense? Done.
The CQ bit was checked by tetsui@google.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
https://codereview.chromium.org/2843683002/diff/40001/ui/file_manager/file_ma... File ui/file_manager/file_manager/foreground/js/file_transfer_controller.js (right): https://codereview.chromium.org/2843683002/diff/40001/ui/file_manager/file_ma... ui/file_manager/file_manager/foreground/js/file_transfer_controller.js:1264: // Remove file objects that are no longer in the selection. It might be better to place this logic in onFileSelectionChangedThrottled_. When a user select the first entry and keep pressing Shift + DOWN, this method will take O(n^2).
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
https://codereview.chromium.org/2843683002/diff/40001/ui/file_manager/file_ma... File ui/file_manager/file_manager/foreground/js/file_transfer_controller.js (right): https://codereview.chromium.org/2843683002/diff/40001/ui/file_manager/file_ma... ui/file_manager/file_manager/foreground/js/file_transfer_controller.js:1264: // Remove file objects that are no longer in the selection. On 2017/04/26 07:14:31, fukino wrote: > It might be better to place this logic in onFileSelectionChangedThrottled_. > > When a user select the first entry and keep pressing Shift + DOWN, this method > will take O(n^2). Done.
lgtm. Thanks!
The CQ bit was checked by tetsui@google.com
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch. Bot data: {"patchset_id": 30002, "attempt_start_ts": 1493192856825790, "parent_rev": "dc1b7c2d8519a2a441edc32a72bb5d8298b134c9", "commit_rev": "3cba6ce1c4b98fb56f02556984813be8697b7729"}
Message was sent while issue was closed.
Description was changed from ========== Reuse File objects in FileTransferController. FileEntry.file is slow operation internally queries file metadata. However, FileTransferController calls FileEntry.file for all the selected files each time CHANGE_THROTTLED event is fired. CHANGE_THROTTLED is fired every time a file is copied during multi file copy. In some slow storage devices which do not support parallel requests such as MTP connected ones, this severely slows down file copy. BUG=712121 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation ========== to ========== Reuse File objects in FileTransferController. FileEntry.file is slow operation internally queries file metadata. However, FileTransferController calls FileEntry.file for all the selected files each time CHANGE_THROTTLED event is fired. CHANGE_THROTTLED is fired every time a file is copied during multi file copy. In some slow storage devices which do not support parallel requests such as MTP connected ones, this severely slows down file copy. BUG=712121 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation Review-Url: https://codereview.chromium.org/2843683002 Cr-Commit-Position: refs/heads/master@{#467270} Committed: https://chromium.googlesource.com/chromium/src/+/3cba6ce1c4b98fb56f0255698481... ==========
Message was sent while issue was closed.
Committed patchset #4 (id:30002) as https://chromium.googlesource.com/chromium/src/+/3cba6ce1c4b98fb56f0255698481... |