pocoproject / poco

The POCO C++ Libraries are powerful cross-platform C++ libraries for building network- and internet-based applications that run on desktop, server, mobile, IoT, and embedded systems.
https://pocoproject.org
Other
8.04k stars 2.11k forks source link

Poco::FileStream std::fstream #4564

Closed micheleselea closed 1 month ago

micheleselea commented 1 month ago

Hi all, I recently done some tests about speed of writing file: in my case is a write to a samba share folder, but it's quite the same on a local drive. I found that if I write 24MB of data file with Poco::FileStream it takes about 2seconds, if I try with std::fstream it takes about 200 milliseconds I think the reason is the "buffer class" between the FileStream and the WriteFile to disk (I'm using windows for these test), because it writes 4096 byte at a time (FileStreamBuf::BUFFER_SIZE). I think we already discuss here on an old post about it, but I don't remember what was the solution. I think probably because std::fstream is c++ portable there's no reason to use Poco::FileStream or do you think that in some specific environment will be better using Poco::FileStream

micheleselea commented 1 month ago

Probably I realized that the Poco::FileStream has a better handle of error exceptions

aleks-f commented 1 month ago

https://github.com/pocoproject/poco/issues/2475

aleks-f commented 1 month ago

I think the main reason for FileStream was to handle unicode file names