boostorg / boostorg/filesystem

boost::filesystem::exists calls made on a network path was found to be 3x slower in Windows after updating boost from 1.81 to 1.84.

Open
#324 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
180
Forks
168
PR merge metrics
No merged PRs in 30d

Description

In our code we have some calls made to boost/filesystem/operations methods. One of these calls was repeatedly checking the existence of some files. After an update from boost 1.81 to 1.84 it was noticed that these calls have become about 3 to 4 times slower in Windows.
I checked the same on a simple test application which performs a call to boost::filesystem::exists on a network path(formatted as "\\\\NETWORK_DRIVE\\FILEPATH") for about a 1000 times. The timing that I got when using 1.81 and 1.84 versions showed a difference of 3.4 times.
I am building the test application using **Visual Studio Professional 2022(64 bit) Version 17.10.6(Visual C++ 2022)**
And running it on a **Windows 11 Pro OS**

The test app that I was running(while using 1.81 and 1.84) separately was following:
```
#include
#include
#include
#include

int main()
{
boost::system::error_code ec;
auto pathString = std::string("\\\\NETWORK_DRIVE\\FILEPATH");

std::size_t totalTime = 0;
for (int i = 0; i < 1000; ++i)
{
auto startTime = std::chrono::high_resolution_clock::now();
auto path = boost::filesystem::path(pathString);
boost::filesystem::exists(path, ec);
auto endTime = std::chrono::high_resolution_clock::now();
auto elapsedTime = std::chrono::duration_cast(endTime - startTime).count();
totalTime += elapsedTime;
std::cout << "TimeElapsed : " << elapsedTime << "\n";
}
std::cout << "TotalTimeElapsed : " << totalTime << "\n";
return 0;
}
```

Is this an expected performance degradation due to some required fixes or could this be improved?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.