These codes are written as a part of Google Summer of Code 2016.
Automatic-selection mechanism for data structures in MRI
Prototypes of Rope data structure for String class of Ruby.
- I implemented concatenation, substring, indexing operations and iterator over string as a data structure in C. (in src/)
- Memory management are done by reference count, and hence good performance is not obtained without memory leak by stopping reference count.
- After that, I wrapped it as an extension of Ruby String object which have methods such as eql, +, concat, length, size, [], delete_at, slice, at, to_s, to_str, inspect, dump. (in ext/rope, especially rb_rope.c is implementation of Rope class)
- Wrapped as Data class in Ruby (Details about Ruby extension: http://docs.ruby-lang.org/en/2.3.0/extension_rdoc.html)
- Finally, I wrote Ruby class ERope(Elastic Rope) for an evaluation of prototyping and dynamic-selection of data structure. ERope class is just a thin wrapper of Ruby string class and Rope class written above, and it can concatenate string as a rope. (in ext/erope, codes here are only for an experiment and not mature at all)
(It may be needed to fix Rakefile, e.g. CC=clang)
rake