celer 1.0.0 copy "celer: ^1.0.0" to clipboard
celer: ^1.0.0 copied to clipboard

Specialized fast async file writer. Celer makes writing to the same file often/concurrently fast and safe.

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)));

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.

You can run benchmark yourself by

dart run benchmark/tester.dart

Disclaimer

It can be measured differently on your computer.

0
likes
150
pub points
0%
popularity

Publisher

unverified uploader

Specialized fast async file writer. Celer makes writing to the same file often/concurrently fast and safe.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

path

More

Packages that depend on celer