domingo, 23 de octubre de 2011

Fastruby 0.0.14 released with support for method replacement

Fastruby is a gem which allows to execute ruby code much faster than normal, currently in a state of transition between a spike and a usable gem, it is released when possible with incremental improvements.
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.git
git checkout v0.0.14
Or install it using gem install:
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)

No hay comentarios:

Publicar un comentario