-
Notifications
You must be signed in to change notification settings - Fork 176
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
[perf] path::parent_path() is slow #88
Comments
To be fair... have you done a performance comparison with some standard versions? https://github.com/gulrak/filesystem/blob/master/include/ghc/filesystem.hpp#L2703 Might also be worth replacing the implementation with dirname and see how that compares. |
Using the following compiler:
And updating the test file to use
Which is a reasonable result. |
I'll look into it, thanks for reporting. |
Okay, I could reproduce your measurements. Thanks for delivering the nice test! On my MacBook Pro i9, 2.4GHz I got:
I reworked the implementation and now get:
It's not as fast as the libc++
But they use string_views internally and as this implementation needs to compile from C++11 on, and I don't want do differentiate too much of the code, I think I am quite happy with the improvement. |
That looks like a good improvement to me, thanks for taking a look. |
This is now part of release v1.5.0 |
Describe the bug
The
path::parent_path()
method is unreasonably slow compared to something like POSIX'sdirname(3)
.To Reproduce
Using this file:
Compiled with:
On my 2013 iMac with a 3.5Ghz Core i7, I get the following results:
Expected behavior
The performance of
parent_path()
should be a lot better.Additional context
I'm using this library in https://github.com/tstack/lnav and
parent_path()
turned out to be a major source of slowness when a lot of files were open.(This library is great, thanks for making it!)
The text was updated successfully, but these errors were encountered: