diff options
| author | 2023-12-04 17:18:47 +0800 | |
|---|---|---|
| committer | 2024-01-12 11:53:05 +0800 | |
| commit | 744796fb34cf87cb75b1c5297bf250cde3b4993d (patch) | |
| tree | f2a524d73e3bd4f3c8cba301627d61a384870bd4 /libs/androidfw/BackupHelpers.cpp | |
| parent | c9f4111cc40ef52b959786b8444d53db2a44dc65 (diff) | |
Add slice copy support for socket file type.
Splice can be used to speed up file copy operations
by avoiding moving any memory between kernel/user space.
But splice copy can not support from socket file to
regular/socket file directly. So use pipe file as proxy,
socket/regular --> pipe --> socket/regular. Even it needs
2 times splice syscall, it is still much faster
than user space copy.
Please refer to the comparison data below for the time
consumption of executing FileUtils.copy in
FileUtilsTest:testCopy_SocketToFile_FileToSocket
file-->socket(unit ms):
32KB: user_cp:0.604, splice_cp:0.113, reduce 80%
32MB: user_cp:236, splice_cp:68, reduce 71%
socket-->file(unit ms):
32KB: user_cp:0.611, splice_cp:0.240, reduce 61%
32MB: user_cp:284, splice_cp:88, reduce 69%
The network environment for this test is localhost,
and the data in real scenarios depends more
on the actual network environment.
Test: atest FrameworksCoreTests:android.os.FileUtilsTest
Change-Id: I0636647934a889ce95bdf4df0db428cb370148fd
Signed-off-by: lizhigang <lizhigang.1220@bytedance.com>
Diffstat (limited to 'libs/androidfw/BackupHelpers.cpp')
0 files changed, 0 insertions, 0 deletions