Skip to content

spinute/CRope

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
ext
 
 
src
 
 
 
 
 
 
 
 

(Experimental) Ruby Rope extension written in C

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.

Short Explanation

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

Build

(It may be needed to fix Rakefile, e.g. CC=clang)

rake