These are chat archives for opal/opal

Jun 2015
Vais Salikhov
Jun 06 2015 02:29

@elia it would indeed be fun if the method_added hook and stringy class_eval were actually available in Opal :)
That said, I managed to cheat around the method_added issue, but class_eval is a show-stopper, so no code-gen benchmarks. (@catmando, btw, this does not seem to work in this case.)
Here are the results I got on my machine for 100_000 iterations:

$ bundle exec opal benchmark/run.rb benchmark/bm_dispatch_bind_table.rb benchmark/bm_dispatch_hardcoded.rb benchmark/bm_dispatch_send.rb benchmark/bm_dispatch_send_table.rb 
benchmark/bm_dispatch_bind_table.rb 11.864
benchmark/bm_dispatch_hardcoded.rb  10.85
benchmark/bm_dispatch_send.rb       11.246
benchmark/bm_dispatch_send_table.rb 11.26
Executed 4 benchmarks in 45.778 sec


Vais Salikhov
Jun 06 2015 02:34
Notable difference from Avdi's MRI results is that there is no 2x slowness for send on Opal - all methods of dispatch seem to have pretty much the same performance, with hard-coded dispatch being slightly faster. Unless, of course, there's something horribly wrong with opal/opal#914 :wink2:
Mitch VanDuyn
Jun 06 2015 03:28
@vais hopefullybi can have a look tomorrow
Adam Beynon
Jun 06 2015 10:56
@elia sorry, missed that question - no I dont use the irc bridge, just use the gitter app
Elia Schito
Jun 06 2015 11:30
@adambeynon Hey thanks , was related to the idea of preparing you a digest
Vais Salikhov
Jun 06 2015 14:34

@adambeynon @elia good news: just noticed that on some benchmarks, Opal actually outperforms MRI (check out factorial and fib below)

$ ruby -v benchmark/run.rb test/cruby/benchmark/bm_app_answer.rb test/cruby/benchmark/bm_app_factorial.rb test/cruby/benchmark/bm_app_fib.rb
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
test/cruby/benchmark/bm_app_answer.rb    0.051471181999659166
test/cruby/benchmark/bm_app_factorial.rb 1.0908229779961403
test/cruby/benchmark/bm_app_fib.rb       0.6289317679984379
$ bundle exec opal -v benchmark/run.rb test/cruby/benchmark/bm_app_answer.rb test/cruby/benchmark/bm_app_factorial.rb test/cruby/benchmark/bm_app_fib.rb 
Opal v0.8.0.rc1
test/cruby/benchmark/bm_app_answer.rb    0.7990000247955322
test/cruby/benchmark/bm_app_factorial.rb 0.08100008964538574
test/cruby/benchmark/bm_app_fib.rb       0.10800004005432129
Executed 3 benchmarks in 0.9880001544952393 sec

Easier head-to-head benchmarking will follow opal/opal#915

Jamie Gaskins
Jun 06 2015 15:32
@vais What kind of setup is needed to run these benchmarks? I get this:
➜  opal git:(master) ruby -v benchmark/run.rb test/cruby/benchmark/bm_app_answer.rb test/cruby/benchmark/bm_app_factorial.rb test/cruby/benchmark/bm_app_fib.rb
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
RUBY_GC_HEAP_INIT_SLOTS=1000000 (default value: 10000)
RUBY_GC_MALLOC_LIMIT=1000000000 (default value: 16777216)
benchmark/run.rb:18: warning: assigned but unused variable - code
/Users/jamie/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- opal/compiler (LoadError)
    from /Users/jamie/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from benchmark/run.rb:1:in `<main>'
@vais if I run with bundle exec, I get benchmark/run.rb:3:in 'require': cannot load such file -- nodejs (LoadError)
Vais Salikhov
Jun 06 2015 15:50
@jgaskins opal/opal#915, it's not merged into master yet :wink:
Jamie Gaskins
Jun 06 2015 15:50
@vais Oooh, okay. Sweet, I'll check that out.
Jamie Gaskins
Jun 06 2015 15:58
@vais Still having a few problems with it. The benchmark files don't appear to be in the repo on your branch?
Vais Salikhov
Jun 06 2015 16:07
@jgaskins looks like maybe you did not git submodule update --init?
The benchmarks are in the cruby submodule
Jamie Gaskins
Jun 06 2015 16:10
Ahhh, okay. You're right, I did not run that because I've never run any git submodule command in my life. :-)
@vais Is that documented somewhere and I just missed it?
Vais Salikhov
Jun 06 2015 16:17
@jgaskins LOL, yeah, I too never used git submodules before Opal :) It's documented here and here
Jamie Gaskins
Jun 06 2015 16:22
Now that you point them out, I do remember seeing it. Still never ran it. :-)
Benoit Daloze
Jun 06 2015 18:41
Hello, I am trying to run the specs with phantomjs, but opening a browser to localhost:9292 does not seem to do anything