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

  1. require "fastruby"  
  2.   
  3. fastruby '  
  4. class X  
  5.   def foo(a)  
  6.     a+1  
  7.   end  
  8. end  
  9. '  
  10.   
  11. x = X.new  
  12. p x.foo(4) # 5  
  13.   
  14. fastruby '  
  15. class X  
  16.   def foo(a)  
  17.     a*2  
  18.   end  
  19. end  
  20. '  
  21.   
  22. 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