Skip to content

Latest commit

 

History

History
118 lines (90 loc) · 6.43 KB

BENCHMARKS.md

File metadata and controls

118 lines (90 loc) · 6.43 KB

Benchmarks

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, chars, 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.

Creation

cargo bench from_str cargo bench builder
from_str builder

Slices

cargo bench byte_slice cargo bench line_slice
byte_slice line_slice
cargo bench from_slice
from_slice                                

Iterators

cargo bench iter_chunks cargo bench iter_bytes
iter_chunks iter_bytes
cargo bench iter_chars cargo bench iter_lines
iter_chars iter_lines

Edits

cargo bench insert_char cargo bench insert_sentence
insert_char insert_sentence
cargo bench insert_large cargo bench delete_char
insert_large delete_char
cargo bench delete_sentence cargo bench delete_large
delete_sentence delete_large
cargo bench replace_char cargo bench replace_sentence
replace_char replace_sentence
cargo bench replace_large
replace_large