Merge lp:~chipaca/snappy/copyfile into lp:~snappy-dev/snappy/snappy-moved-to-github
| Status: | Merged |
|---|---|
| Approved by: | Sergio Schvezov on 2015-05-05 |
| Approved revision: | 440 |
| Merged at revision: | 438 |
| Proposed branch: | lp:~chipaca/snappy/copyfile |
| Merge into: | lp:~snappy-dev/snappy/snappy-moved-to-github |
| Diff against target: |
505 lines (+385/-50) 8 files modified
helpers/cp.go (+91/-0) helpers/cp_linux.go (+46/-0) helpers/cp_linux_test.go (+44/-0) helpers/cp_other.go (+30/-0) helpers/cp_test.go (+169/-0) policy/policy.go (+3/-28) policy/policy_test.go (+1/-1) snappy/build.go (+1/-21) |
| To merge this branch: | bzr merge lp:~chipaca/snappy/copyfile |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Sergio Schvezov | Approve on 2015-05-05 | ||
| John Lenton | Abstain on 2015-05-02 | ||
|
Review via email:
|
|||
Commit Message
Moved two implementations of Copy into helpers with the linux implementation being based on sendfile.
Description of the Change
Moved two implementations of Copy into helpers.
Because I was having fun, also implemented copy using sendfile when in linux.
Using sendfile avoids at least two copies over read/write; more if copying multiple chunks of data (currently golang's io does chunks of 32k).
On the bbb, copying a 10M file using io.Copy takes .79s/.03s/.26s (real/user/sys); doing it using sendfile uses .64s/.01s/.13s (averaged over 10 runs).
This requires a kernel newer than 2.6.33, which should not be a problem.
| John Lenton (chipaca) wrote : | # |
| John Lenton (chipaca) wrote : | # |
All set now :)
| Sergio Schvezov (sergiusens) wrote : | # |
Just really quickly going to say THANK YOU.
The split of OS dependent implementations is also welcoming.
I'll do a proper review later today during layovers
| Michael Vogt (mvo) wrote : | # |
This looks very nice, thanks for doing this!
META: It seems this is a good time to branch trunk into trunk and 15.04. This branch should go to trunk and I think we want to do fixes for 15.04 as well (but this branch looks more like trunk/devel material to me).
Some comments/questions inline. I really like that this branch removes duplicated code and moves in into a single well tested (and speedy!) place.
| John Lenton (chipaca) wrote : | # |
And neither of you spotted that I was not returning the error from copyfile. heh.
- 439. By John Lenton on 2015-05-02
-
mock all the things. Then, test all the things.
| John Lenton (chipaca) wrote : | # |
Michael, I think this pretty much covers the test you wanted ;)
- 440. By John Lenton on 2015-05-05
-
durr


Moving to WIP, because I kinda forgot all about permissions.