diff --git a/cpp/src/Private/sweepstore/benchmark.cpp b/cpp/src/Private/sweepstore/benchmark.cpp index c94f864..5703a23 100644 --- a/cpp/src/Private/sweepstore/benchmark.cpp +++ b/cpp/src/Private/sweepstore/benchmark.cpp @@ -35,7 +35,7 @@ int main() { SweepstoreConcurrency::initialiseMasterAsync(filePath); - int iterations = 1; + int iterations = 100; int currentIteration = 0; while (true) { diff --git a/cpp/src/Private/sweepstore/utils/file_handle.cpp b/cpp/src/Private/sweepstore/utils/file_handle.cpp index ce85a7f..cf6b583 100644 --- a/cpp/src/Private/sweepstore/utils/file_handle.cpp +++ b/cpp/src/Private/sweepstore/utils/file_handle.cpp @@ -55,6 +55,7 @@ void SweepstoreFileHandle::close() { #endif } +#if defined(_WIN32) || defined(WITH_UNREAL) // flush void SweepstoreFileHandle::flush() { #ifdef WITH_UNREAL @@ -64,15 +65,12 @@ void SweepstoreFileHandle::flush() { #else if (stream) { stream->flush(); -#ifdef _WIN32 // On Windows, also sync to ensure data hits disk stream->sync(); -#endif } #endif } -#if defined(_WIN32) || defined(WITH_UNREAL) // readSeek void SweepstoreFileHandle::readSeek(std::streampos pos, std::ios::seekdir dir) { #ifdef WITH_UNREAL diff --git a/cpp/src/Public/sweepstore/utils/file_handle.h b/cpp/src/Public/sweepstore/utils/file_handle.h index 334919a..b346cbc 100644 --- a/cpp/src/Public/sweepstore/utils/file_handle.h +++ b/cpp/src/Public/sweepstore/utils/file_handle.h @@ -37,16 +37,21 @@ public: bool isOpen() const; void close(); - void flush(); // Windows-compatible I/O wrappers #if defined(_WIN32) || defined(WITH_UNREAL) + void flush(); void readSeek(std::streampos pos, std::ios::seekdir dir = std::ios::beg); void writeSeek(std::streampos pos, std::ios::seekdir dir = std::ios::beg); void readBytes(char* buffer, std::streamsize size); void writeBytes(const char* buffer, std::streamsize size); #else // Inline for non-Windows to avoid overhead + inline void flush() { + if (stream) { + stream->flush(); + } + } inline void readSeek(std::streampos pos, std::ios::seekdir dir = std::ios::beg) { stream->seekg(pos, dir); }