0 purchases
celer
celer #
Specialized fast async file writer
ported by JS steno
Celer means fast in Latin.
Features #
Celer makes writing to the same file often/concurrently fast and safe.
⚡ pretty fast under specific situation (see benchmark)
Included the Benchmark/Test in a flutter way
Caution
in normal situation like single-time write, it rather be slower than the normal dart:io method
Getting started #
nothing needs to be started.
Usage #
/// data setup codes
final dir = await Directory.systemTemp.createTemp('celer-test-');
final celerFile = File(p.join(dir.path, 'celer.txt'));
final data = String.fromCharCodes(List.filled(1024, 'x'.codeUnitAt(0)));
final dataset = List.generate(1000, (index) => data);
/// usage
/// init celer writer
final celer = CelerWriter(celerFile.path);
/// write
/// Repeatedly write to the same file
await Future.wait(dataset.map((e) => celer.write(e)));
copied to clipboard
Additional information #
In benchmark, We measured and compared the time when writing kb,mb-sized text 1000 times to the same file.
Write 1KB data to the same file x 1000
celer(Runtime): 5820.627906976744 us.
io(Runtime): 115485.27777777778 us.
-----------------------------------
Write 1MB data to the same file x 1000
celer(Runtime): 22048.14285714286 us.
io(Runtime): 7442817.0 us.
copied to clipboard
You can run benchmark yourself by
dart run benchmark/tester.dart
copied to clipboard
Disclaimer
It can be measured differently on your computer.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.