Note: We changed the name of the database in May 2012. AvocadoDB is now called ArangoDB

I’m still investigating the possibility to use mruby as embedded language for AvocadoDB, see me last post. I managed to create an interactive shell to play with mruby. Now am trying to do some performance tests.

Note that mruby is still “alpha”, so DO NOT take these test to seriously. They are basically just for me to learn, how to use mruby.

Exposing a C function to MRUBY

The first function I need is a timing function. I’ve implemented such a function in C using gettimeofday. Now in order to make it accessible from mruby I’ve used

mrb_define_method defines a new method in a class or module. I’m not sure what the correct module or class is, so for my tests I’ve chosen the Kernel module. ARGS_NONE() is used for functions that take no arguments.

MRuby

Testing it as follows works

As expected it is too fast to be usable. So, I’ve used a loop

So there is also no big difference between integer and floats. Both of with are stored as immediate values in mruby. Note that there is no Bignum in mruby.

JavaScript

The same in JavaScript V8 give:

JavaScript is currently faster – but note that mruby is still in an very early stage. BTW, I’ve used “-O2” for both V8 and mruby.

Ruby 1.8.7

Using “irb” one gets

So in this particular example, mruby is a lot faster than Ruby 1.8. Again, it is too early to draw any conclusions.

Ruby 1.9

Using “irb” one gets

Next Steps

I need to do more tests to see how easy it is to really embed the language in to ArangoDB. And I also need to do some more tests.