The following benchmarks measure crop's performance against
Jumprope and Ropey across 4 different use cases:
- creating a rope from a string or using a builder;
- slicing the rope and converting the slice back to an owned
Rope
;
- iterating over the rope's chunks, bytes,
char
s, and lines;
- editing the rope by continuously inserting/deleting/replacing text
at random offsets;
using 4 different input texts to track the change in performance as the size of
the underlying buffer increases:
It wasn't possible to add Jumprope to the builder
and *_slice
benchmarks
because it doesn't provide similar APIs, and it wasn't included in the iter_*
benchmarks because even though
some
iterators
are implemented, they are not exported publicly.
The xi_rope
project was not included in the benchmarks as it's been
discontinued together with the rest of the Xi editor (and it was about an order
of magnitude slower that all the other ropes on most use cases).
The code used to run the benchmarks can be found
here.
All the benchmarks were run on a 2018 MacBook Pro with a (not so) mighty 2.2
GHz 6-Core Intel Core i7.
cargo bench from_str |
cargo bench builder |
|
|
cargo bench byte_slice |
cargo bench line_slice |
|
|
cargo bench from_slice |
|
|
|
cargo bench iter_chunks |
cargo bench iter_bytes |
|
|
cargo bench iter_chars |
cargo bench iter_lines |
|
|
cargo bench insert_char |
cargo bench insert_sentence |
|
|
cargo bench insert_large |
cargo bench delete_char |
|
|
cargo bench delete_sentence |
cargo bench delete_large |
|
|
cargo bench replace_char |
cargo bench replace_sentence |
|
|
cargo bench replace_large |
|
|
|