aboutsummaryrefslogtreecommitdiffstats
path: root/array.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Enhanced RDoc for Array (#3282)Burdette Lamar2020-07-081-59/+140
| | | | | | | | | | | | Methods: reject! reject delete_if zip transpose replace clear
* Enhanced RDoc for Array (#3276)Burdette Lamar2020-07-031-51/+191
| | | | | | | | | *Methods: keep_if delete delete_at slice!
* rb_ary_slice_bang: do not goto into a branch卜部昌平2020-06-291-22/+38
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* ary_join_1: do not goto into a branch卜部昌平2020-06-291-35/+38
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* rb_ary_aset: do not goto into a branch卜部昌平2020-06-291-14/+22
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* add spaces [ci skip]卜部昌平2020-06-291-1/+8
|
* ary_ensure_room_for_unshift: do not goto into a branch卜部昌平2020-06-291-31/+44
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* rb_ary_behead: do not goto into a branch卜部昌平2020-06-291-21/+35
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* [ci skip] Enhanced RDoc for Array (#3252)Burdette Lamar2020-06-241-73/+132
| | | | | | | | | | Methods: map/collect map!/collect! values_at select/filter select!/filter!
* [ci skip] Enhanced RDoc for Array (#3237)Burdette Lamar2020-06-231-107/+272
| | | | | | | | | | | Methods: #rotate! #rotate #sort! #sort #bsearch #bsearch_index
* [ci skip] Enhanced RDoc for Array (#3224)Burdette Lamar2020-06-181-31/+52
| | | | | | | | | | Methods: #to_a #to_h #to_ary #reverse! #reverse
* Remove non-US-ASCII characters [ci skip]Nobuyoshi Nakada2020-06-141-2/+2
|
* [ci skip] Enhanced RDoc for Array (#3219)Burdette Lamar2020-06-131-19/+59
| | | | | | | | Methods: #join #inspect/#to_s #to_a
* [ci skip] Enhanced Rdoc for Array (#3216)Burdette Lamar2020-06-121-46/+160
| | | | | | | | | | | Methods: #insert #each #each_index #reverse_each #length #empty?
* Enhanced Rdoc for Array#rindex and Array#[]= (#3204)Burdette Lamar2020-06-111-57/+189
| | | | | * Enhanced Rdoc for Array#rindex and Array#[]= * Enhanced Rdoc for Array#rindex and Array#[]=
* Enhanced Rdoc for Array#fetch and Array#index (#3202)Burdette Lamar2020-06-101-40/+94
| | | | | * Enhanced Rdoc for Array#fetch and Array#index * Couple of tweaks (per review) in Rdoc for Hash
* Enhanced Rdoc for Array (#3193)Burdette Lamar2020-06-091-96/+294
| | | | | | | | | | | | | | | Methods: #freeze #<< #push #pop #shift #unshift #slice #at #first #last
* Fix max, min, minmax documentation (#3131)Masataka Pocke Kuwabara2020-05-261-2/+2
| | | | They only need that all objects implement <=>, but the documentation said it needs Comparable.
* Suppress warnings no inline ruby debug (#3107)Kenta Murata2020-05-221-1/+1
| | | | | * Suppress unused warnings occurred due to -fno-inline * Suppress warning occurred due to RUBY_DEBUG=1
* add static modifier to rb_ary_aref2 funcS-H-GAMELINKS2020-05-191-1/+1
|
* [ci skip] Rdoc enhancements for Array (#3063)Burdette Lamar2020-05-151-83/+191
| | | | | | | * Per @nobu review * Rdoc enhancements for Array * Responses to review
* reroute redefinition of NDEBUG卜部昌平2020-04-211-0/+1
| | | | | NDEBUG can be defined via a command-line argument. Should take care of such situations.
* Merge pull request #2991 from shyouhei/ruby.h卜部昌平2020-04-081-10/+11
| | | Split ruby.h
* Removed non-RUBY_INTEGER_UNIFICATION codeNobuyoshi Nakada2020-03-211-1/+1
|
* fix compile error w/ -DUSE_TRANSIENT_HEAP=0卜部昌平2020-03-041-0/+2
| | | | | rb_transient_heap_managed_ptr_p is available only when USE_TRANSIENT_HEAP. Need #if guards.
* Document that Array#index and find_index are aliases [ci skip]Chelsea Corvus (Battell)2020-02-251-0/+2
|
* Moved Array#sample to rbincNobuyoshi Nakada2020-01-261-50/+3
|
* Moved Array#shuffle and Array#shuffle! to rbincNobuyoshi Nakada2020-01-261-50/+6
|
* Recheck array length after `to_str` conversionNobuyoshi Nakada2020-01-251-1/+3
| | | | https://hackerone.com/reports/244787
* Recheck elements type after `to_str` conversionNobuyoshi Nakada2020-01-251-2/+4
| | | | https://hackerone.com/reports/244786
* Optimize Array#rotate!(n) for n = 1 and n = -1Ary Borenszweig2019-12-291-5/+15
| | | | | | | 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.
* decouple internal.h headers卜部昌平2019-12-261-5/+16
| | | | | | | | | | | | | | | | | | 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).
* make functions static卜部昌平2019-11-191-0/+2
| | | | | | | 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.
* Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans2019-11-181-11/+0
| | | | | | 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.
* Prefer st_is_member over st_lookup with 0Ben Woosley2019-10-091-1/+1
| | | | The st_is_member DEFINE has simpler semantics, for more readable code.
* Improve performance of Array#sum with float elements (#1555)Watson2019-10-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add: Array#intersection methodPrajjwal Singh2019-10-071-0/+31
|
* array.c (rb_mem_clear): remove "register" from argumentsYusuke Endoh2019-10-041-1/+1
| | | | | | | | | | | | | | | | 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); ^~~~~~~~~ ```
* [DOC] Fix typos in Array#{to_s,inspect} doc [ci skip]Benoit Daloze2019-09-291-1/+1
|
* [DOC] stated that Array#to_s calls #inspect [ci skip]Nobuyoshi Nakada2019-09-291-1/+2
| | | | [ruby-list:50826]
* Optimize Array#flatten and flatten! for already flattened arrays (#2495)Dylan Thacker-Smith2019-09-281-10/+33
| | | | | | | * Optimize Array#flatten and flatten! for already flattened arrays * Add benchmark for Array#flatten and Array#flatten! [Bug #16119]
* check `ARY_SHARED_ROOT_P()`.Koichi Sasada2019-09-251-1/+5
| | | | | ARY_SHARED_ROOT_P(ary) is true, ARY_HEAP_CAPA(ary) should not be called.
* introduce `obj_ary_extracapa`.Koichi Sasada2019-09-251-0/+2
| | | | | Introduce a new debug counter `obj_ary_extracapa` which counts arrays which are `len < capa`.
* Fixed memory leakNobuyoshi Nakada2019-09-201-3/+8
| | | | | * array.c (flatten): fix a memory leak in the case of an exception at conversion of an element to Array.
* Fix typosKenichi Kamiya2019-09-181-5/+5
|
* Make Array#uniq return subclass instance if called on subclass instanceJeremy Evans2019-09-021-4/+8
| | | | | | | | 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]
* Avoid confusion in Array#- and Array#difference docs (#2070)Olivier Lacan2019-08-161-6/+6
| | | | | | My previous attempt to correct #2068 apparently failed and the confusing wording ("instances") was merged into trunk instead. This should address any potential confusion.
* Allow Array#join to allocate smaller stringsJohn Hawthorn2019-08-091-1/+3
| | | | | | | | | | | | | | rb_str_buf_new always allocates at least 127 bytes of capacity, even when less is requested. > ObjectSpace.dump(%w[a b c].join) {"address":"0x7f935f06ebf0", "type":"STRING", "class":"0x7f935d8b7bb0", "bytesize":3, "capacity":127, "value":"abc", "encoding":"UTF-8", "memsize":168, "flags":{"wb_protected":true}} Instead, by using rb_str_new and then setting the length to 0, we can allocate the exact amount of memory needed, without extra capacity. > ObjectSpace.dump(%w[a b c].join) {"address":"0x7f903fcab530", "type":"STRING", "class":"0x7f903f8b7988", "embedded":true, "bytesize":3, "value":"abc", "encoding":"UTF-8", "memsize":40, "flags":{"wb_protected":true}}
* array.c: gc.h is not neededYusuke Endoh2019-08-071-1/+0
|
* [Doc] Fix Array#to_h call-seqKenichi Kamiya2019-08-041-2/+2
| | | | Closes: https://github.com/ruby/ruby/pull/2254