Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copy_file is around 6 times slower than it was in 1.70 #186

Closed
barendgehrels opened this issue Apr 30, 2021 · 5 comments
Closed

copy_file is around 6 times slower than it was in 1.70 #186

barendgehrels opened this issue Apr 30, 2021 · 5 comments

Comments

@barendgehrels
Copy link

Upgrading Boost from 1.70 to 1.75 we discovered that the performance of copy_file is quite decreased.

Especially if you copy many small files this is noticeable.

Here are my measurements (3 runs of both versions):

107500 - copy /home/gehrels/current_boost/boost time 42933 ms
107500 - copy /home/gehrels/current_boost/boost time 43256 ms
107500 - copy /home/gehrels/current_boost/boost time 42684 ms

107000 - copy /home/gehrels/current_boost/boost time 6646 ms
107000 - copy /home/gehrels/current_boost/boost time 6844 ms
107000 - copy /home/gehrels/current_boost/boost time 6574 ms

(I clean the file cache before each run using echo 3 | sudo tee /proc/sys/vm/drop_caches)

Attached the minimal example, creating these measurements, copying the "boost" folder from Boost (15344 files on my system)

use_boost_fs.cpp.zip

@Lastique
Copy link
Member

What OS are you running? If Linux, what is your kernel version?

@barendgehrels
Copy link
Author

barendgehrels commented Apr 30, 2021

I'm running on Linux nl1lxl-110718 4.15.0-142-generic #146-Ubuntu SMP Tue Apr 13 01:11:19 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

But the problem also occurs on computers of my colleagues and for our test suites.

And, another observation, if I comment these lines in operations.cpp:

//#if defined(BOOST_FILESYSTEM_HAS_FDATASYNC)
//  err = ::fdatasync(outfile.fd);
//#else
//  err = ::fsync(outfile.fd);
//#endif

the degradation is gone. So apparently it's the syncing taking time.

@Lastique
Copy link
Member

It is expected then. The comment above that call explains why syncing is performed.

@barendgehrels
Copy link
Author

Sure, I read it. But the std library (C++17) doesn't do this. Shouldn't they be compatible?

I think that the syncing, if any, should be optional. At any rate, there should not be a regression of 6 times which cannot be avoided somehow.

@barendgehrels
Copy link
Author

Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants