[ruby-dev:50071] [Ruby trunk Bug#13340][Assigned] Improve performance of Array#sort with float elements

From: muraken@...
Date: 2017-04-13 07:07:23 UTC
List: ruby-dev #50071
Issue #13340 has been updated by mrkn (Kenta Murata).

Status changed from Open to Assigned
Assignee set to mrkn (Kenta Murata)

----------------------------------------
Bug #13340: Improve performance of Array#sort with float elements
https://bugs.ruby-lang.org/issues/13340#change-64205

* Author: watson1978 (Shizuo Fujita)
* Status: Assigned
* Priority: Normal
* Assignee: mrkn (Kenta Murata)
* Target version: 
* ruby -v: 
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
Array#sort with float elements will be over 2 times faster.

### Before
~~~
       user     system      total        real
   5.650000   0.020000   5.670000 (  5.661151)
~~~

### After
~~~
       user     system      total        real
   2.410000   0.010000   2.420000 (  2.427718)
~~~

### Test code
~~~
require 'benchmark'

Benchmark.bmbm do |x|

  ary = []
  1000.times { |i| ary << Random.rand }

  x.report do

    10000.times do
      ary.sort
    end

  end

end
~~~

### Patch
The patch is in https://github.com/ruby/ruby/pull/1539



-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next