Re: [Rails-core] Increase speed creating new array

2016-05-05 Thread Ufuk Kayserilioglu
Andrey, Be careful with this because the sematics of the two are not exactly equal: [1] pry(main)> Array([123]) => [123] [2] pry(main)> [[123]] => [[123]] and the desired sematics in the locations that you link to seem to be the Array() variant where the input might be a scalar or an array itse

[Rails-core] Increase speed creating new array

2016-05-05 Thread Andrey Molchanov
Hi all, In some places new array creates as a Array(). I

[Rails-core] Increase performance

2016-05-05 Thread Andrey Molchanov
I propose replace all the endless loop do to while true: NUMBER = 100_000_000 def old_slow index = 0 loop do break if index > NUMBER index += 1 end end def new_fast index = 0 while true break if index > NUMBER index += 1 end end Benchmark.ips do |x| x.report("new_