| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
| |
* enum.c: [DOC] reword docs for Enumerable#{any?,all?,none?,one?}
to not mention the receiver (`enum') from call-seq, because it
does not appear in the call-seq of the rendered HTML docs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
and specialized Array#any? and Hash#any?
Based on patch by D.E. Akers [#11286]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
* enum.c (enum_cycle_size): check an argument before the size of
the receiver, if it is given.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
| |
Patch by Kenichi Kamiya
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* enum.c (enum_collect): make the block arity same as the given
block. [Bug #13391]
* internal.h (vm_ifunc): store arity instead of unused id.
* proc.c (rb_vm_block_min_max_arity): return ifunc arity.
* vm_eval.c (rb_lambda_call): call method with lambda block.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
| |
* enum.c (uniq_func, uniq_iter): need packed value as the unique
key. [ruby-core:81734] [Bug #13669] [Fix GH-1658]
Author: Kenichi Kamiya <kachick1@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* internal.h (rb_yield_lambda): rename to rb_yield_force_blockarg()
because this function prohibt lambda arg setup (strict setup).
* vm.c (invoke_iseq_block_from_c): remove splattable argument because
it is not used.
* vm.c (invoke_block_from_c_splattable): rename to invoke_block_from_c_bh()
because `splattable` doesn't make sense on current this function.
Also accept `force_blockarg' parameter instead of `splattable` parameter.
It is more clear.
* vm.c (invoke_block_from_c_unsplattable): rename to
invoke_block_from_c_proc() and accept `proc` instead of `block'.
This function is used only by proc block invocation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
| |
* enum.c (cmpint_reenter_check): extract from nmin_cmp and
nmin_block_cmp.
* enum.c (nmin_cmp): check if reentered before rb_cmpint.
[Feature #13437]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is totally same approach with r58964.
enum.c (sort_by_cmp): use OPTIMIZED_CMP() to compare the objects instead of
`<=>' method dispatching for Fixnum/Float/String object.
enum.c (nmin_cmp): ditto.
enum.c (min_by_i): ditto.
enum.c (max_by_i): ditto.
enum.c (minmax_by_i_update): ditto.
enum.c (minmax_by_i): ditto.
Enumerable#sort_by -> 51 % up
Enumerable#min_by(n) -> 34 % up
Enumerable#min_by -> 37 % up
Enumerable#max_by(n) -> 61 % up
Enumerable#max_by -> 40 % up
Enumerable#minmax_by -> 67 % up
[ruby-core:80689] [Bug #13437] [Fix GH-1584]
### Before
Enumerable#sort_by 5.692k (± 2.2%) i/s - 28.611k in 5.028861s
Enumerable#min_by(n) 8.496k (± 0.5%) i/s - 43.146k in 5.078394s
Enumerable#min_by 8.678k (± 0.5%) i/s - 43.911k in 5.060128s
Enumerable#max_by(n) 3.306k (± 3.0%) i/s - 16.562k in 5.014727s
Enumerable#max_by 8.322k (± 2.8%) i/s - 42.400k in 5.099400s
Enumerable#minmax_by 6.769k (± 2.6%) i/s - 34.100k in 5.041354s
### After
Enumerable#sort_by 8.591k (± 3.0%) i/s - 43.316k in 5.046836s
Enumerable#min_by(n) 11.489k (± 1.2%) i/s - 57.732k in 5.025504s
Enumerable#min_by 11.835k (± 2.7%) i/s - 60.150k in 5.086450s
Enumerable#max_by(n) 5.322k (± 1.1%) i/s - 26.650k in 5.008289s
Enumerable#max_by 11.705k (± 0.6%) i/s - 59.262k in 5.062997s
Enumerable#minmax_by 11.323k (± 1.3%) i/s - 57.018k in 5.036565s
### Test code
require 'benchmark/ips'
Benchmark.ips do |x|
enum = (1..1000).to_a.to_enum
x.report "Enumerable#sort_by" do
enum.sort_by { |a| a }
end
x.report "Enumerable#min_by(n)" do
enum.min_by(2) { |a| a }
end
x.report "Enumerable#min_by" do
enum.min_by { |a| a }
end
x.report "Enumerable#max_by(n)" do
enum.max_by(2) { |a| a }
end
x.report "Enumerable#max_by" do
enum.max_by { |a| a }
end
x.report "Enumerable#minmax_by" do
enum.minmax_by { |a| a }
end
end
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
* enum.c (ary_inject_op): should respect method visibility, do not
optimize uncallable method. [ruby-core:81349] [Bug #13592]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
|
|
| |
* vm_eval.c (rb_yield_lambda): new function which yields an array
to a proc and splat to a lambda. mainly for Enumerable only.
* vm_args.c (setup_parameters_complex): remove special lambda
splatting for [Bug #9605]. [ruby-core:77065] [Bug #12705]
* vm_insnhelper.c (vm_callee_setup_block_arg): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
| |
* array.c: [DOC] fix grammar in Array#sort, #sort!, #sort_by!,
move references below the code example, add a missing reference.
* enum.c: [DOC] fix grammar in Enumerable#sort, #sort_by.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
| |
* enum.c: [DOC] improve structure of docs for Enumerable#sort_by,
adopt explanation of the comparison block from Array#sort_by,
drop mention of 1.8, fix typos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
| |
The argument for Enumerable#slice_before is is removed at Ruby 2.3.
Reported by Shyouhei Urabe. [Bug #13202]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
| |
* enum.c (rb_nmin_run): set the class with write barrier.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57436 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
|
|
| |
* enum.c: [DOC] Enumerable#{min,min_by,max,max_by} return a sorted
array when +n+ argument is used.
* enum.c: Small typo : minimum -> maximum
[Bug #13161]
Author: Eric Duminil <eric.duminil@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57434 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
| |
[ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
|
|
| |
* array.c (rb_ary_sum): change the algorithm to Kahan-Babuska balancing
summation to be more precise.
[Feature #12871] [ruby-core:77771]
* enum.c (sum_iter, enum_sum): ditto.
* test_array.rb, test_enum.rb: add an assertion for the above change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
| |
* array.c (rb_ary_sort_bang, rb_ary_sort, rb_ary_sort_by_bang):
[DOC] describe that sort may not be stable.
* enum.c (enum_sort, enum_sort_by): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
| |
[fix GH-1400][ci skip] Patch by @getaaron
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
| |
an Enumerator [#2172]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
| |
* fix typos, "a" before "Integer" to "an". [Fix GH-1438]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
* enum.c (enum_uniq): add rdoc, reference to Array#uniq.
[Feature #11090]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
* enum.c (enum_uniq): new method Enumerable#uniq.
[Feature #11090]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
|
| |
* internal.h (NEW_PARTIAL_MEMO_FOR): shrink buffer array not to
mark non-VALUE fields. fix check_rvalue_consistency abort with
RGENGC_CHECK_MODE=2.
* internal.h (NEW_CMP_OPT_MEMO): exclude struct cmp_opt_data from
the valid array range.
* enum.c (slicewhen_i): exclude inverted too.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
* enum.c (sum_iter): workaround of mixed declarations and code.
erred by -Werror=declaration-after-statement option.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
* enum.c (enum_sum, hash_sum, hash_sum_i, enum_sum_i, sum_iter):
Optimize for hashes when each method isn't redefined.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
* enum.c (enum_sum, int_range_sum): Extract int_range_sum from
enum_sum.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* enum.c (enum_sum): Optimize for a range from int to int.
* test/ruby/test_enum.rb (test_range_sum): Move from test_range.rb,
and add assertions for some conditions.
* test/ruby/test_enum.rb (test_hash_sum): Move from test_hash.rb.
* test/ruby/test_hash.rb, test/ruby/test_range.rb: Remove test_sum.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
|
|
| |
* enum.c (enum_sum): Implement Enumerable#sum.
* test/ruby/test_enum.rb (test_sum): Test sum for Enumerable.
* test/ruby/test_hash.rb (test_sum): Test sum for Hash.
* test/ruby/test_range.rb (test_sum): Test sum for Range.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* object.c, numeric.c, enum.c, ext/-test-/bignum/mul.c,
lib/rexml/quickpath.rb, lib/rexml/text.rb, lib/rexml/xpath_parser.rb,
lib/rubygems/specification.rb, lib/uri/generic.rb,
bootstraptest/test_eval.rb, basictest/test.rb,
test/-ext-/bignum/test_big2str.rb, test/-ext-/bignum/test_div.rb,
test/-ext-/bignum/test_mul.rb, test/-ext-/bignum/test_str2big.rb,
test/csv/test_data_converters.rb, test/date/test_date.rb,
test/json/test_json_generate.rb, test/minitest/test_minitest_mock.rb,
test/openssl/test_cipher.rb, test/rexml/test_jaxen.rb,
test/ruby/test_array.rb, test/ruby/test_basicinstructions.rb,
test/ruby/test_bignum.rb, test/ruby/test_case.rb,
test/ruby/test_class.rb, test/ruby/test_complex.rb,
test/ruby/test_enum.rb, test/ruby/test_eval.rb,
test/ruby/test_iseq.rb, test/ruby/test_literal.rb,
test/ruby/test_math.rb, test/ruby/test_module.rb,
test/ruby/test_numeric.rb, test/ruby/test_range.rb,
test/ruby/test_rational.rb, test/ruby/test_refinement.rb,
test/ruby/test_rubyvm.rb, test/ruby/test_struct.rb,
test/ruby/test_variable.rb, test/rubygems/test_gem_specification.rb,
test/thread/test_queue.rb: Use Integer instead of Fixnum and Bignum.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
| |
* enum.c (enum_find): [DOC] add more examples to the documentation
of Enumerable#detect, to show that it equals to Enumerable#find.
[Fix GH-1340]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Kahan's compensated summation algorithm for precise sum of float
numbers is moved from ary_inject_op in enum.c.
* enum.c (ary_inject_op): Don't specialize for float numbers.
[ruby-core:74569] [Feature#12217] proposed by mrkn.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
| |
for summing up float values.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
| |
float numbers.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
| |
arguments. replace super call with rb_nmin_run.
* enum.c (nmin_run): exported (as rb_nmin_run).
* internal.h: added a prototype for rb_nmin_run.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
[Feature #12172]
* internal.h (OPTIMIZED_CMP): moved from enum.c so that array.c can
use it.
* test/ruby/test_array.rb (test_max, test_min): tests for Array#max
and Array#min.
* test/ruby/test_enum.rb (test_max, test_min): revised a bit to test
Enumerable#max and #min explicitly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|