gulrak / filesystem

An implementation of C++17 std::filesystem for C++11 /C++14/C++17/C++20 on Windows, macOS, Linux and FreeBSD.
MIT License
1.31k stars 168 forks source link

Proposal: Performance optimization for Windows #136

Closed phprus closed 2 years ago

phprus commented 2 years ago

1) Apply clang-format 2) Replace std::shared_ptr to std::unique_ptr because std::unique_ptr does not use reference counter. 3) Replace std::shared_ptr<void> (for storing handle) to custom unique_handle class because std::shared_ptr use reference counter.

In all cases, a reference count is not needed, since the stored object exists in a single instance.

Replace std::shared_ptr<void> to std::unique_ptr is wrong, because std::unique_ptr doesn't call deleter on zero pointer and zero - is valid handle value.

phprus commented 2 years ago

@gulrak, I am sorry to distract you. When you have time, please review this PR.

gulrak commented 2 years ago

Thank you! I'll look into it this evening and as far as I can see it will be in 1.5.10. - I Needed to delay that release due to time constrains but really plan finishing it over the weekend, as I'm starting to now have a bit more time at my hands again.

gulrak commented 2 years ago

Nice, thank you! My only issue might be the different member marking style in the new helper class, but I can fix that when I wrap up the release.