diff options
author | mrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-04-13 09:25:38 +0000 |
---|---|---|
committer | mrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-04-13 09:25:38 +0000 |
commit | cb8012f5c0a6bb8dd62e788c5484b92b3c7df978 (patch) | |
tree | 098346926986c3a5c4d298f6c0012e5246ceabb1 /array.c | |
parent | 53430e355ad5e52504f9a9848447ffb926e4fb6c (diff) |
array.c: improve performance of Array#sort with block
* array.c (sort_1): improve performance of Array#sort with block
* benchmark/bm_array_sort_block.rb: added for Array#sort with block
[Bug #13344]
[ruby-dev:50027]
[Fix GH-1544]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r-- | array.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -2396,9 +2396,12 @@ sort_1(const void *ap, const void *bp, void *dummy) struct ary_sort_data *data = dummy; VALUE retval = sort_reentered(data->ary); VALUE a = *(const VALUE *)ap, b = *(const VALUE *)bp; + VALUE args[2]; int n; - retval = rb_yield_values(2, a, b); + args[0] = a; + args[1] = b; + retval = rb_yield_values2(2, args); n = rb_cmpint(retval, a, b); sort_reentered(data->ary); return n; |