Граф коммитов

939 Коммитов

Автор SHA1 Сообщение Дата
Burdette Lamar 35e5b8fb82
Enhanced RDoc for Array (#3372) 2020-07-29 18:25:24 -04:00
BurdetteLamar e1b6e1d126 Enhanced RDoc for Array [ci skip] 2020-07-28 12:01:46 -07:00
Kazuhiro NISHIYAMA 946cd6c534
Use https instead of http 2020-07-28 19:51:54 +09:00
Burdette Lamar 5d04ac6ea2
Enhanced RDoc for Array (#3350)
* Enhanced RDoc for Array

Methods:

    ==
    eql?
    hash
    include?
    <=>
2020-07-22 19:06:49 -05:00
BurdetteLamar a50750c8a9 Enhanced RDoc for Array 2020-07-21 17:07:12 -05:00
BurdetteLamar d29de7b31b Enhanced RDoc for Array 2020-07-21 17:07:12 -05:00
BurdetteLamar 8a974e0fcb Enhanced RDoc for Array 2020-07-21 17:07:12 -05:00
Kenta Murata b4e784434c
Optimize Array#min (#3324)
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.
2020-07-18 23:45:25 +09:00
Kenta Murata a63f520971
Optimize Array#max (#3325)
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|
2020-07-18 23:45:00 +09:00
Burdette Lamar 3b96ad9b54
Enhanced RDoc for Array#fill (#3301)
* 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>
2020-07-11 08:01:56 -05:00
Burdette Lamar 9fc25811d5
Enhanced RDoc for Array (#3282)
Methods:

    reject!
    reject
    delete_if
    zip
    transpose
    replace
    clear
2020-07-08 09:27:10 -05:00
Burdette Lamar e8010c7401
Enhanced RDoc for Array (#3276)
*Methods:

    keep_if
    delete
    delete_at
    slice!
2020-07-03 09:49:36 -05:00
卜部昌平 4f2425549a rb_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.
2020-06-29 11:05:41 +09:00
卜部昌平 73f98d25eb ary_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.
2020-06-29 11:05:41 +09:00
卜部昌平 4dc83eefce rb_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.
2020-06-29 11:05:41 +09:00
卜部昌平 2d6f8db3d6 add spaces [ci skip] 2020-06-29 11:05:41 +09:00
卜部昌平 86c869fb59 ary_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.
2020-06-29 11:05:41 +09:00
卜部昌平 2e8d8d10f2 rb_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.
2020-06-29 11:05:41 +09:00
Burdette Lamar 5e860ed4c1
[ci skip] Enhanced RDoc for Array (#3252)
Methods:

    map/collect
    map!/collect!
    values_at
    select/filter
    select!/filter!
2020-06-24 13:31:42 -05:00
Burdette Lamar dc351ff984
[ci skip] Enhanced RDoc for Array (#3237)
Methods:

    #rotate!
    #rotate
    #sort!
    #sort
    #bsearch
    #bsearch_index
2020-06-23 08:58:26 -05:00
Burdette Lamar a5bc0b8f8c
[ci skip] Enhanced RDoc for Array (#3224)
Methods:

    #to_a
    #to_h
    #to_ary
    #reverse!
    #reverse
2020-06-18 08:30:04 -05:00
Nobuyoshi Nakada b8804010fb
Remove non-US-ASCII characters [ci skip] 2020-06-14 23:59:48 +09:00
Burdette Lamar 8b58f1d8c7
[ci skip] Enhanced RDoc for Array (#3219)
Methods:

    #join
    #inspect/#to_s
    #to_a
2020-06-13 09:14:17 -05:00
Burdette Lamar eabdad5e2f
[ci skip] Enhanced Rdoc for Array (#3216)
Methods:

    #insert
    #each
    #each_index
    #reverse_each
    #length
    #empty?
2020-06-12 11:32:31 -05:00
Burdette Lamar eb5ecc2ea8
Enhanced Rdoc for Array#rindex and Array#[]= (#3204)
* Enhanced Rdoc for Array#rindex and Array#[]=

* Enhanced Rdoc for Array#rindex and Array#[]=
2020-06-11 10:55:11 -05:00
Burdette Lamar 8d4b259408
Enhanced Rdoc for Array#fetch and Array#index (#3202)
* Enhanced Rdoc for Array#fetch and Array#index
* Couple of tweaks (per review) in Rdoc for Hash
2020-06-10 06:45:29 -05:00
Burdette Lamar b85b866300
Enhanced Rdoc for Array (#3193)
Methods:

    #freeze
    #<<
    #push
    #pop
    #shift
    #unshift
    #slice
    #at
    #first
    #last
2020-06-09 13:57:41 -05:00
Masataka Pocke Kuwabara a3f498e44c
Fix max, min, minmax documentation (#3131)
They only need that all objects implement <=>,
but the documentation said it needs Comparable.
2020-05-26 23:48:46 -07:00
Kenta Murata f4f157fc81
Suppress warnings no inline ruby debug (#3107)
* Suppress unused warnings occurred due to -fno-inline

* Suppress warning occurred due to RUBY_DEBUG=1
2020-05-22 13:49:08 +09:00
S-H-GAMELINKS 1f063abb4c add static modifier to rb_ary_aref2 func 2020-05-19 15:22:53 +09:00
Burdette Lamar 24739c62e5
[ci skip] Rdoc enhancements for Array (#3063)
* Per @nobu review

* Rdoc enhancements for Array

* Responses to review
2020-05-15 14:12:40 -07:00
卜部昌平 32623150cd reroute redefinition of NDEBUG
NDEBUG can be defined via a command-line argument.  Should take care of
such situations.
2020-04-21 13:07:19 +09:00
卜部昌平 9e6e39c351
Merge pull request #2991 from shyouhei/ruby.h
Split ruby.h
2020-04-08 13:28:13 +09:00
Nobuyoshi Nakada 5b287481be
Removed non-RUBY_INTEGER_UNIFICATION code 2020-03-21 16:59:55 +09:00
卜部昌平 2325017477 fix compile error w/ -DUSE_TRANSIENT_HEAP=0
rb_transient_heap_managed_ptr_p is available only when USE_TRANSIENT_HEAP.
Need #if guards.
2020-03-04 12:30:42 +09:00
Chelsea Corvus (Battell) 672213ef1c
Document that Array#index and find_index are aliases [ci skip] 2020-02-25 13:43:17 -05:00
Nobuyoshi Nakada d4e1d4e94e
Moved Array#sample to rbinc 2020-01-26 19:45:58 +09:00
Nobuyoshi Nakada 29eb1b1602
Moved Array#shuffle and Array#shuffle! to rbinc 2020-01-26 19:40:34 +09:00
Nobuyoshi Nakada 0c436bbfbf
Recheck array length after `to_str` conversion
https://hackerone.com/reports/244787
2020-01-25 14:06:38 +09:00
Nobuyoshi Nakada 2b2821acd3
Recheck elements type after `to_str` conversion
https://hackerone.com/reports/244786
2020-01-25 13:57:33 +09:00
Ary Borenszweig e5c441a4a2 Optimize Array#rotate!(n) for n = 1 and n = -1
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.
2019-12-29 13:12:42 +09:00
卜部昌平 5e22f873ed decouple 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).
2019-12-26 20:45:12 +09:00
卜部昌平 0e8219f591 make 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.
2019-11-19 12:36:19 +09:00
Jeremy Evans ffd0820ab3 Deprecate taint/trust and related methods, and make the methods no-ops
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.
2019-11-18 01:00:25 +02:00
Ben Woosley bb71a128eb Prefer st_is_member over st_lookup with 0
The st_is_member DEFINE has simpler semantics, for more readable code.
2019-10-09 23:46:50 +09:00
Watson 2d001003e4 Improve performance of Array#sum with float elements (#1555)
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-09 12:25:07 +09:00
Prajjwal Singh c8542ab484 Add: Array#intersection method 2019-10-07 15:59:12 +09:00
Yusuke Endoh 113bef6976 array.c (rb_mem_clear): remove "register" from arguments
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-10-04 16:07:46 +09:00
Benoit Daloze ce477089f6 [DOC] Fix typos in Array#{to_s,inspect} doc [ci skip] 2019-09-29 11:04:28 +02:00
Nobuyoshi Nakada e2d97cffe5
[DOC] stated that Array#to_s calls #inspect [ci skip]
[ruby-list:50826]
2019-09-29 17:28:58 +09:00