5 ms·
I am always happy to unwrap my Christmas present from the Ruby team! Some questions about this release: - Are there any benchmarks for the new JIT? - Why was
by maxfurman 8y ago
I am always happy to unwrap my Christmas present from the Ruby team! Some questions about this release:
- Are there any benchmarks for the new JIT?
- Why was `(Date.today..(Date.today + 1)) === DateTime.now #=> true` false in Ruby 2.5? It seems correct that right now is between today and tomorrow. Is it because one is a Date and the other a DateTime?
- koolba 8y agoBeen a while since I’ve used any Ruby but isn’t the first expression a range where’s the second a single value? It’d be like [0,1] === 0
- chrisseaton 8y ago> isn’t the first expression a range where’s the second a single value? `===` conventionally means 'matches', or 'includes', so an aggregate on the LHS and a scalar on the RHS is typical. It isn't defined for `Array` beyond being the default of equality - I don't know why - but it is defined for `Range`.
- anamexis 8y agoAbout your question, the reason is that `===` is aliased to `Range#include?` which checks if the argument is a discrete element contained in the range. That range of `Date`s does not include any `DateTime`s, so the inclusion check returns false. `Range#cover?` on the other hand, just uses >= and <= to check .
- ciconia 8y ago> Are there any benchmarks for the new JIT? From the horse's mouth: "...apparently JIT on Ruby 2.6 failed to be ready for production." [1] [1] https://medium.com/@k0kubun/ruby-2-6-jit-progress-and-future-84e0a830ecbf https://medium.com/@k0kubun/ruby-2-6-jit-progress-and-future...
- Rafert 8y agoBenchmarks here: https://medium.com/@k0kubun/ruby-2-6-jit-progress-and-future-84e0a830ecbf https://medium.com/@k0kubun/ruby-2-6-jit-progress-and-future... tl;dr: your Rails app is not faster with this feature in this version, but might be in the future.
- Koshkin 8y ago> (Date.today..(Date.today + 1)) === DateTime.now #=> true It took me a minute to parse this. (I have never had this problem with Python or JS.)
- maxfurman 8y agoSorry - this is pasted out of the article, and refers to a change in the semantics of the === operator for Ranges.
- yxhuvud 8y agoNote that you would almost never use the === directly - usually it is done by invoking a case statement, so it would be like case DateTime.now when Date.today..(Date.today + 1) .. do something else .. or not end
- igouy 8y agofwiw https://benchmarksgame-team.pages.debian.net/benchmarksgame/faster/ruby.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/... Some of those Ruby 2.6 programs are faster with --jit and others are faster without --jit faster or similar: nbody #2, fasta #6, fannkuchredux #2, spectralnorm #4 slower with --jit: binarytrees #5, pidigits #5, regexredux #3, revcomp #5, mandelbrot #2, knucleotide #1