From cb8012f5c0a6bb8dd62e788c5484b92b3c7df978 Mon Sep 17 00:00:00 2001 From: mrkn Date: Thu, 13 Apr 2017 09:25:38 +0000 Subject: 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 --- array.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'array.c') diff --git a/array.c b/array.c index e07e91bc3c..8e24da2ce6 100644 --- a/array.c +++ b/array.c @@ -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; -- cgit v1.2.3