The v0.0.14 release make a internal redesign of the method hash structure to allow the store of function pointer pointers, this is what allows to reference a fixed function pointer which may change enabling method replacement while retaining most of the performance (fastruby calls now consume a extra indirection and a few extra checks)
Install
You can clone the repository at github:
git clone git://github.com/tario/fastruby.gitOr install it using gem install:
git checkout v0.0.14
gem install fastruby
New Features
Examples of code being supported
Replacement of methods
require "fastruby"
fastruby '
class X
def foo(a)
a+1
end
end
'
x = X.new
p x.foo(4) # 5
fastruby '
class X
def foo(a)
a*2
end
end
'
p x.foo(4) # 8
Remaining uncovered items on v0.0.14 release
- Memory handling of function pointers on method hash (will be fixed for v0.0.15)
- Fix limitation of 15 arguments when calling method defined on fastruby from normal ruby
- Fix duplication of objects on cache when methods are replaced
- Optimization of splat callls, currently this calls are executing using normal rb_funcall2 (will be improved for v0.2.0)
- Optimization of calls to methods with variable number of arguments, currently are wrapped using rb_funcall (will be improved for v0.2.0)