summaryrefslogtreecommitdiff
path: root/array.c
AgeCommit message (Collapse)Author
2020-07-18Optimize Array#min (#3324)Kenta Murata
The benchmark result is below: | |compare-ruby|built-ruby| |:---------------|-----------:|---------:| |ary2.min | 39.105M| 39.442M| | | -| 1.01x| |ary10.min | 23.995M| 30.762M| | | -| 1.28x| |ary100.min | 6.249M| 10.783M| | | -| 1.73x| |ary500.min | 1.408M| 2.714M| | | -| 1.93x| |ary1000.min | 828.397k| 1.465M| | | -| 1.77x| |ary2000.min | 332.256k| 570.504k| | | -| 1.72x| |ary3000.min | 338.079k| 573.868k| | | -| 1.70x| |ary5000.min | 168.217k| 286.114k| | | -| 1.70x| |ary10000.min | 85.512k| 143.551k| | | -| 1.68x| |ary20000.min | 43.264k| 71.935k| | | -| 1.66x| |ary50000.min | 17.317k| 29.107k| | | -| 1.68x| |ary100000.min | 9.072k| 14.540k| | | -| 1.60x| |ary1000000.min | 872.930| 1.436k| | | -| 1.64x| compare-ruby is 9f4b7fc82e. Notes: Merged-By: mrkn <mrkn@ruby-lang.org>
2020-07-18Optimize Array#max (#3325)Kenta Murata
The benchmark result is below: | |compare-ruby|built-ruby| |:---------------|-----------:|---------:| |ary2.max | 38.837M| 40.830M| | | -| 1.05x| |ary10.max | 23.035M| 32.626M| | | -| 1.42x| |ary100.max | 5.490M| 11.020M| | | -| 2.01x| |ary500.max | 1.324M| 2.679M| | | -| 2.02x| |ary1000.max | 699.167k| 1.403M| | | -| 2.01x| |ary2000.max | 284.321k| 570.446k| | | -| 2.01x| |ary3000.max | 282.613k| 571.683k| | | -| 2.02x| |ary5000.max | 145.120k| 285.546k| | | -| 1.97x| |ary10000.max | 72.102k| 142.831k| | | -| 1.98x| |ary20000.max | 36.065k| 72.077k| | | -| 2.00x| |ary50000.max | 14.343k| 29.139k| | | -| 2.03x| |ary100000.max | 7.586k| 14.472k| | | -| 1.91x| |ary1000000.max | 726.915| 1.495k| | | -| 2.06x| Notes: Merged-By: mrkn <mrkn@ruby-lang.org>
2020-07-11Enhanced RDoc for Array#fill (#3301)Burdette Lamar
* Enhanced RDoc for Array#fill * Update array.c There's one more at 5072. I'll get it. Co-authored-by: Eric Hodel <drbrain@segment7.net> * Update array.c Co-authored-by: Eric Hodel <drbrain@segment7.net> * Update array.c Co-authored-by: Eric Hodel <drbrain@segment7.net> * Update array.c Co-authored-by: Eric Hodel <drbrain@segment7.net> * Update array.c Co-authored-by: Eric Hodel <drbrain@segment7.net> * Update array.c Co-authored-by: Eric Hodel <drbrain@segment7.net> Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-07-08Enhanced RDoc for Array (#3282)Burdette Lamar
Methods: reject! reject delete_if zip transpose replace clear Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-07-03Enhanced RDoc for Array (#3276)Burdette Lamar
*Methods: keep_if delete delete_at slice! Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-06-29rb_ary_slice_bang: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-29ary_join_1: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-29rb_ary_aset: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-29add spaces [ci skip]卜部昌平
Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-29ary_ensure_room_for_unshift: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-29rb_ary_behead: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-24[ci skip] Enhanced RDoc for Array (#3252)Burdette Lamar
Methods: map/collect map!/collect! values_at select/filter select!/filter! Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-06-23[ci skip] Enhanced RDoc for Array (#3237)Burdette Lamar
Methods: #rotate! #rotate #sort! #sort #bsearch #bsearch_index Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-06-18[ci skip] Enhanced RDoc for Array (#3224)Burdette Lamar
Methods: #to_a #to_h #to_ary #reverse! #reverse Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-06-14Remove non-US-ASCII characters [ci skip]Nobuyoshi Nakada
2020-06-13[ci skip] Enhanced RDoc for Array (#3219)Burdette Lamar
Methods: #join #inspect/#to_s #to_a Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-06-12[ci skip] Enhanced Rdoc for Array (#3216)Burdette Lamar
Methods: #insert #each #each_index #reverse_each #length #empty? Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-06-11Enhanced Rdoc for Array#rindex and Array#[]= (#3204)Burdette Lamar
* Enhanced Rdoc for Array#rindex and Array#[]= * Enhanced Rdoc for Array#rindex and Array#[]= Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-06-10Enhanced Rdoc for Array#fetch and Array#index (#3202)Burdette Lamar
* Enhanced Rdoc for Array#fetch and Array#index * Couple of tweaks (per review) in Rdoc for Hash Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-06-09Enhanced Rdoc for Array (#3193)Burdette Lamar
Methods: #freeze #<< #push #pop #shift #unshift #slice #at #first #last Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2020-05-26Fix max, min, minmax documentation (#3131)Masataka Pocke Kuwabara
They only need that all objects implement <=>, but the documentation said it needs Comparable. Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2020-05-22Suppress warnings no inline ruby debug (#3107)Kenta Murata
* Suppress unused warnings occurred due to -fno-inline * Suppress warning occurred due to RUBY_DEBUG=1 Notes: Merged-By: mrkn <mrkn@ruby-lang.org>
2020-05-19add static modifier to rb_ary_aref2 funcS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/3119
2020-05-15[ci skip] Rdoc enhancements for Array (#3063)Burdette Lamar
* Per @nobu review * Rdoc enhancements for Array * Responses to review Notes: Merged-By: drbrain <drbrain@segment7.net>
2020-04-21reroute redefinition of NDEBUG卜部昌平
NDEBUG can be defined via a command-line argument. Should take care of such situations.
2020-04-08Merge pull request #2991 from shyouhei/ruby.h卜部昌平
Split ruby.h Notes: Merged-By: shyouhei <shyouhei@ruby-lang.org>
2020-03-21Removed non-RUBY_INTEGER_UNIFICATION codeNobuyoshi Nakada
2020-03-04fix compile error w/ -DUSE_TRANSIENT_HEAP=0卜部昌平
rb_transient_heap_managed_ptr_p is available only when USE_TRANSIENT_HEAP. Need #if guards.
2020-02-25Document that Array#index and find_index are aliases [ci skip]Chelsea Corvus (Battell)
Notes: Merged: https://github.com/ruby/ruby/pull/2924 Merged-By: XrXr
2020-01-26Moved Array#sample to rbincNobuyoshi Nakada
2020-01-26Moved Array#shuffle and Array#shuffle! to rbincNobuyoshi Nakada
2020-01-25Recheck array length after `to_str` conversionNobuyoshi Nakada
https://hackerone.com/reports/244787
2020-01-25Recheck elements type after `to_str` conversionNobuyoshi Nakada
https://hackerone.com/reports/244786
2019-12-29Optimize Array#rotate!(n) for n = 1 and n = -1Ary Borenszweig
For the most common cases of `rotate!` one place to the right or to the left, instead of doing some reversals of the array we just keep a single value in a temporary value, use memmove and then put the temporary value where it should be. Notes: Merged: https://github.com/ruby/ruby/pull/2710
2019-12-26decouple internal.h headers卜部昌平
Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies). Notes: Merged: https://github.com/ruby/ruby/pull/2711
2019-11-19make functions static卜部昌平
These functions are used from within a compilation unit so we can make them static, for better binary size. This changeset reduces the size of generated ruby binary from 26,590,128 bytes to 26,584,472 bytes on my macihne. Notes: Merged: https://github.com/ruby/ruby/pull/2682
2019-11-18Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans
This removes the related tests, and puts the related specs behind version guards. This affects all code in lib, including some libraries that may want to support older versions of Ruby. Notes: Merged: https://github.com/ruby/ruby/pull/2476
2019-10-09Prefer st_is_member over st_lookup with 0Ben Woosley
The st_is_member DEFINE has simpler semantics, for more readable code. Notes: Merged: https://github.com/ruby/ruby/pull/1622
2019-10-09Improve performance of Array#sum with float elements (#1555)Watson
The declaration of local variable in loop, it will initialize local variable for each run of the loop with clang generated code. So, it shouldn't declare the local variable in heavy loop. Array#sum with float elements will be faster around 30%. * Before user system total real 3.320000 0.010000 3.330000 ( 3.336088) * After user system total real 2.590000 0.010000 2.600000 ( 2.602399) * Test code require 'benchmark' Benchmark.bmbm do |x| ary = [] 10000.times { ary << Random.rand } x.report do 50000.times do ary.sum end end end
2019-10-07Add: Array#intersection methodPrajjwal Singh
Notes: Merged: https://github.com/ruby/ruby/pull/2533
2019-10-04array.c (rb_mem_clear): remove "register" from argumentsYusuke Endoh
to suppress the following warning: ``` compiling cxxanyargs.cpp In file included from cxxanyargs.cpp:1: In file included from ../../.././include/ruby/ruby.h:2150: ../../.././include/ruby/intern.h:56:19: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register] void rb_mem_clear(register VALUE*, register long); ^~~~~~~~~ ../../.././include/ruby/intern.h:56:36: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register] void rb_mem_clear(register VALUE*, register long); ^~~~~~~~~ ```
2019-09-29[DOC] Fix typos in Array#{to_s,inspect} doc [ci skip]Benoit Daloze
2019-09-29[DOC] stated that Array#to_s calls #inspect [ci skip]Nobuyoshi Nakada
[ruby-list:50826]
2019-09-28Optimize Array#flatten and flatten! for already flattened arrays (#2495)Dylan Thacker-Smith
* Optimize Array#flatten and flatten! for already flattened arrays * Add benchmark for Array#flatten and Array#flatten! [Bug #16119]
2019-09-25check `ARY_SHARED_ROOT_P()`.Koichi Sasada
ARY_SHARED_ROOT_P(ary) is true, ARY_HEAP_CAPA(ary) should not be called.
2019-09-25introduce `obj_ary_extracapa`.Koichi Sasada
Introduce a new debug counter `obj_ary_extracapa` which counts arrays which are `len < capa`.
2019-09-20Fixed memory leakNobuyoshi Nakada
* array.c (flatten): fix a memory leak in the case of an exception at conversion of an element to Array.
2019-09-18Fix typosKenichi Kamiya
Notes: Merged: https://github.com/ruby/ruby/pull/2467
2019-09-02Make Array#uniq return subclass instance if called on subclass instanceJeremy Evans
Previously, Array#uniq would return subclass instance if the length of the array were 2 or greater, and would return Array instance if the length of the array were 0 or 1. Fixes [Bug #7768]
2019-08-16Avoid confusion in Array#- and Array#difference docs (#2070)Olivier Lacan
My previous attempt to correct #2068 apparently failed and the confusing wording ("instances") was merged into trunk instead. This should address any potential confusion.