Refactor concurrency handling and improve sleep precision in concurrency.dart and header.dart

This commit is contained in:
ImBenji
2025-11-23 17:57:30 +00:00
parent 2de17fe720
commit 747f0bd1ed
5 changed files with 48 additions and 124 deletions

View File

@@ -40,7 +40,7 @@ class Sweepstore {
keyHash: key.hashCode,
writeSize: 0, // Placeholder
onApproved: () {
print("Writing key: $key with hash ${key.hashCode} and value: $value");
// print("Writing key: $key with hash ${key.hashCode} and value: $value");
},
debugLabel: key
);
@@ -60,16 +60,16 @@ Future<void> main() async {
Sweepstore store = Sweepstore(filePath);
store.initialise(
concurrentWorkers: 20
concurrentWorkers: 18
);
initialiseMasterListener(file.openSync(mode: FileMode.append));
print(binaryDump(file.readAsBytesSync()));
int iteration = 1;
int iteration = 100;
for (int j = 0; j < iteration; j++) {
int concurrencyTest = 256;
int concurrencyTest = 128;
final receivePort = ReceivePort();
int completedJobs = 0;
@@ -101,5 +101,7 @@ Future<void> main() async {
print('\x1B[95mAll jobs completed!\x1B[0m');
print('\x1B[95mTime taken: ${stopwatch.elapsedMilliseconds}ms (${stopwatch.elapsed.inSeconds}s)\x1B[0m');
// sleep(Duration(seconds: 2));
}
}