These are chat archives for opal/opal

Jul 2015
Jamie Gaskins
Jul 29 2015 02:07
I upgraded to Opal 0.8 on Rails 4.2.3, and opal-rspec0.4.3, and I can't run specs anymore inside the browser. I moved my spec files to /spec-opal but when I try to run them, it gives me NoMethodError: undefined method 'describe' for main. Anyone else seen this? @elia
Bozhidar Batsov
Jul 29 2015 04:45
@fkchang no, I haven't
@fkchang btw, I think that focusing only on the browser is the wrong way to go about Opal
in the ClojureScript community they’re focusing a lot on node, React Native, desktop apps
obivously the browser is the simplest pitch, but these days you can do a lot more with JS
@elia will do
Elia Schito
Jul 29 2015 06:24
@jgaskins you need to require opal-rspec explicitly
that's to allow people to use eg. minitest instead
@jgaskins Maybe we should add an to all repos wdyt?
Bozhidar Batsov
Jul 29 2015 06:44
or this should be just a part of the readme
Elia Schito
Jul 29 2015 08:03
@bbatsov :tulip: opal/opal-rails@79a23da
Elia Schito
Jul 29 2015 08:09
@fkchang new talks idea: piggybacking on crystal could work, maybe people interested in crystal are more likely to be more open-minded toward Opal and combining them could help gaining supporters
Bozhidar Batsov
Jul 29 2015 09:34
@elia Nice!
Bozhidar Batsov
Jul 29 2015 11:46
btw, does someone have some ready-made Opal benchmarks I can use for my eurucamp presentation?
I’m a bit short on time and I won’t be able to do tests myself
but it’d probably be good to have something on the topic in the slides
Elia Schito
Jul 29 2015 12:04
@bbatsov there's a benchmark folder in the opal repo, was curated by @vais
Vais Salikhov
Jul 29 2015 13:05
@bbatsov currently there are no benchmarks comparing JavaScript and Opal. The challenge is that it's a little like comparing apples and oranges. If you have any ideas on how to do that, lmk. You could compare Opal to MRI Ruby, but that's not very useful. I do use benchmarks to compare Opal to Opal when making changes to the corelib to make sure there are no performance regressions. And for that I do use MRI numbers as a baseline (but mostly for giggles). Here is an example: I am working on a large change to Hash to make it completely match Ruby semantics and pass the remaining RubySpecs, but sacrificing performance is not an option, so benchmarking is a big part of the work:
$ bundle exec rake bench:report
Benchmark                                                           Opal1   Opal2   Opal3   Opal4  Ruby1
/Users/vais/Desktop/benchmark/bm_hash_assoc_object.rb               0.675   0.915   0.822   0.836  0.016
/Users/vais/Desktop/benchmark/bm_hash_assoc_string.rb               2.866   2.741   2.840   2.786  0.015
/Users/vais/Desktop/benchmark/bm_hash_clone_object.rb               1.710   2.070   1.849   1.846  0.690
/Users/vais/Desktop/benchmark/bm_hash_clone_string.rb               0.165   0.350   0.352   0.277  0.725
/Users/vais/Desktop/benchmark/bm_hash_delete_object.rb              0.746   0.179   0.208   0.121  0.016
/Users/vais/Desktop/benchmark/bm_hash_delete_string.rb              2.936   0.030   0.029   0.030  0.008
/Users/vais/Desktop/benchmark/bm_hash_each_key_object.rb            0.159   0.218   0.225   0.195  1.316
/Users/vais/Desktop/benchmark/bm_hash_each_key_string.rb            0.131   0.175   0.162   0.168  0.876
/Users/vais/Desktop/benchmark/bm_hash_each_object.rb                7.846   0.814   0.816   0.834  1.173
/Users/vais/Desktop/benchmark/bm_hash_each_string.rb                0.799   0.838   0.813   0.857  0.913
/Users/vais/Desktop/benchmark/bm_hash_each_value_object.rb          6.721   0.268   0.268   0.261  1.085
/Users/vais/Desktop/benchmark/bm_hash_each_value_string.rb          0.199   0.194   0.203   0.200  0.866
/Users/vais/Desktop/benchmark/bm_hash_element_reference_object.rb   0.126   0.214   0.208   0.179  0.014
/Users/vais/Desktop/benchmark/bm_hash_element_reference_string.rb   0.017   0.018   0.021   0.019  0.011
/Users/vais/Desktop/benchmark/bm_hash_element_set_object.rb         0.406   0.837   0.645   0.728  0.102
/Users/vais/Desktop/benchmark/bm_hash_element_set_string.rb         0.130   0.141   0.127   0.146  0.068
/Users/vais/Desktop/benchmark/bm_hash_equal_value_object.rb        11.988  10.678   9.553   9.771  2.980
/Users/vais/Desktop/benchmark/bm_hash_equal_value_string.rb         2.387   0.214   0.231   0.223  1.227
/Users/vais/Desktop/benchmark/bm_hash_fetch_object.rb               0.098   0.115   0.107   0.110  0.008
/Users/vais/Desktop/benchmark/bm_hash_fetch_string.rb               0.014   0.014   0.019   0.014  0.013
/Users/vais/Desktop/benchmark/bm_hash_flatten_object.rb             6.994   0.233   0.212   0.228  0.780
/Users/vais/Desktop/benchmark/bm_hash_flatten_string.rb             0.252   0.262   0.251   0.252  0.677
/Users/vais/Desktop/benchmark/bm_hash_has_key_object.rb            11.334   0.125   0.115   0.110  0.012
/Users/vais/Desktop/benchmark/bm_hash_has_key_string.rb            14.081   0.020   0.021   0.018  0.007
/Users/vais/Desktop/benchmark/bm_hash_has_value_object.rb           0.800   0.228   0.226   0.226  0.095
/Users/vais/Desktop/benchmark/bm_hash_has_value_string.rb           0.173   0.120   0.125   0.125  0.044
/Users/vais/Desktop/benchmark/bm_hash_hash_object.rb                2.293   2.080   2.086   2.122  0.039
/Users/vais/Desktop/benchmark/bm_hash_hash_string.rb                1.902   1.810   1.836   1.862  0.042
/Users/vais/Desktop/benchmark/bm_hash_inspect_object.rb             2.946   1.794   1.459   1.611  4.441
/Users/vais/Desktop/benchmark/bm_hash_inspect_string.rb             1.417   1.208   1.245   1.440  0.940
Ruby1 column on the far right is MRI. These changes and benchmarks are in my hash branch on my Opal fork I have not pushed them yet, it's a WIP.
More about how benchmarking works here: This area of the project could use a lot of improvement, feedback and ideas very welcome :wink:
Bozhidar Batsov
Jul 29 2015 15:53
yeah, I totally get what you mean
but people like numbers that look good, when they’re considering some technology
I remember @ryanstout had cooked exactly a comparison between Opal and JS for his RubyConf talk
anyways, my current idea is too simply say that a lot of decisions have been made to ensure the speed is as fast as possible (compiler handling of method missing, mapping of strings and numbers, etc)
guess this should be enough
Elia Schito
Jul 29 2015 17:04
@bbatsov yes, all that stuff has been developed constantly measuring alternatives on jsperf when it was still usable
Jul 29 2015 17:05
bbatsov, for the record, most of the performance hit comes from operators, since they're forced to be method calls
Bozhidar Batsov
Jul 29 2015 17:16
good to know
Mitch VanDuyn
Jul 29 2015 17:56
Man does any body have any ideas for adding a feature to opal-rspec so that you could rerun an example!
During async running it would be great to keep retrying the example until it passes. Anybody got any ideas how this might be done?
Jamie Gaskins
Jul 29 2015 18:02
@elia I think it'd be a good idea to add some info about upgrading. I didn't see anything in opal-rails or opal-rspec mentioning explicitly requiring in the spec files (or a spec_helper or something) — should it be require 'opal-rspec' in my Opal code or just require 'rspec'?
Elia Schito
Jul 29 2015 18:56
@jgaskins it's both opal and opal-rspec
Forrest Chang
Jul 29 2015 22:57
@elia already been thinking about the "crystopal" stack, though I dunno if I will pitch that one for RubyConf (CFP ends Aug 31 - I wanna make sure I can demo something if I were to pitch that)
I think the 1st hurdle might be to implement some sort of asset pipeline for crystal, no one else has
but then I think I should do some opal-inspector stuff instead
Rick Carlino
Jul 29 2015 22:59
@fkchang Is registration closed for attendees already?
Elia Schito
Jul 29 2015 23:18
@fkchang Not sure crystal needs an asset pipeline thingy, you can do most with the sprockets command or a rakefile (if I understood wat you meant…)
Forrest Chang
Jul 29 2015 23:49
@RickCarlino registration hasn't opened yet, I think it usually opens after CFP is over (coz they want to tease the good talks, IMO)
@elia I'm game for a workaround, but I do like how sprockets auto compiles my opal so I just edit and refresh the page