Increase benchmark iterations to 100 and enhance flush method for Windows compatibility

This commit is contained in:
ImBenji
2025-12-02 15:37:32 +00:00
parent 82efc4a524
commit fa50810212
3 changed files with 8 additions and 5 deletions

View File

@@ -35,7 +35,7 @@ int main() {
SweepstoreConcurrency::initialiseMasterAsync(filePath); SweepstoreConcurrency::initialiseMasterAsync(filePath);
int iterations = 1; int iterations = 100;
int currentIteration = 0; int currentIteration = 0;
while (true) { while (true) {

View File

@@ -55,6 +55,7 @@ void SweepstoreFileHandle::close() {
#endif #endif
} }
#if defined(_WIN32) || defined(WITH_UNREAL)
// flush // flush
void SweepstoreFileHandle::flush() { void SweepstoreFileHandle::flush() {
#ifdef WITH_UNREAL #ifdef WITH_UNREAL
@@ -64,15 +65,12 @@ void SweepstoreFileHandle::flush() {
#else #else
if (stream) { if (stream) {
stream->flush(); stream->flush();
#ifdef _WIN32
// On Windows, also sync to ensure data hits disk // On Windows, also sync to ensure data hits disk
stream->sync(); stream->sync();
#endif
} }
#endif #endif
} }
#if defined(_WIN32) || defined(WITH_UNREAL)
// readSeek // readSeek
void SweepstoreFileHandle::readSeek(std::streampos pos, std::ios::seekdir dir) { void SweepstoreFileHandle::readSeek(std::streampos pos, std::ios::seekdir dir) {
#ifdef WITH_UNREAL #ifdef WITH_UNREAL

View File

@@ -37,16 +37,21 @@ public:
bool isOpen() const; bool isOpen() const;
void close(); void close();
void flush();
// Windows-compatible I/O wrappers // Windows-compatible I/O wrappers
#if defined(_WIN32) || defined(WITH_UNREAL) #if defined(_WIN32) || defined(WITH_UNREAL)
void flush();
void readSeek(std::streampos pos, std::ios::seekdir dir = std::ios::beg); 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 writeSeek(std::streampos pos, std::ios::seekdir dir = std::ios::beg);
void readBytes(char* buffer, std::streamsize size); void readBytes(char* buffer, std::streamsize size);
void writeBytes(const char* buffer, std::streamsize size); void writeBytes(const char* buffer, std::streamsize size);
#else #else
// Inline for non-Windows to avoid overhead // 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) { inline void readSeek(std::streampos pos, std::ios::seekdir dir = std::ios::beg) {
stream->seekg(pos, dir); stream->seekg(pos, dir);
} }