sink icon indicating copy to clipboard operation
sink copied to clipboard

Optimization: use ropes under the hood

Open velipso opened this issue 8 years ago • 1 comments

The C implementation of strings is pretty dumb and straight forward (and slow).

We should probably implement a form of rope under the hood. Notice that node.js's v8 already does in some form, because ./perf/cat.sink runs significantly faster in the JS implementation.

See: https://en.wikipedia.org/wiki/Rope_(data_structure)

We can likely keep the C API the same, and just use ropes internally, and flatten ropes when sink_caststr is called.

velipso avatar Apr 27 '17 18:04 velipso

Perhaps another link of interest:

http://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=181EEF66EB411F4277C009A1D492CF75?doi=10.1.1.14.9450&rep=rep1&type=pdf

velipso avatar Apr 27 '17 18:04 velipso