Age | Commit message (Collapse) | Author |
|
NDEBUG can be defined via a command-line argument. Should take care of
such situations.
|
|
Split ruby.h
Notes:
Merged-By: shyouhei <[email protected]>
|
|
|
|
rb_transient_heap_managed_ptr_p is available only when USE_TRANSIENT_HEAP.
Need #if guards.
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/2924
Merged-By: XrXr
|
|
|
|
|
|
https://hackerone.com/reports/244787
|
|
https://hackerone.com/reports/244786
|
|
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
|
|
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
|
|
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
|
|
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
|
|
The st_is_member DEFINE has simpler semantics, for more readable code.
Notes:
Merged: https://github.com/ruby/ruby/pull/1622
|
|
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
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/2533
|
|
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);
^~~~~~~~~
```
|
|
|
|
[ruby-list:50826]
|
|
* Optimize Array#flatten and flatten! for already flattened arrays
* Add benchmark for Array#flatten and Array#flatten!
[Bug #16119]
|
|
ARY_SHARED_ROOT_P(ary) is true, ARY_HEAP_CAPA(ary) should not
be called.
|
|
Introduce a new debug counter `obj_ary_extracapa` which counts
arrays which are `len < capa`.
|
|
* array.c (flatten): fix a memory leak in the case of an exception
at conversion of an element to Array.
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/2467
|
|
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]
|
|
My previous attempt to correct #2068 apparently failed and the confusing
wording ("instances") was merged into trunk instead.
This should address any potential confusion.
|
|
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}}
|
|
|
|
Closes: https://github.com/ruby/ruby/pull/2254
|
|
Closes: https://github.com/ruby/ruby/pull/2255
|
|
ARY_SHARED_P and ARY_EMBED_P included:
assert(!FL_TEST((ary), ELTS_SHARED) || !FL_TEST((ary), RARRAY_EMBED_FLAG)),
The two predicate macros are used in many other assert conditions,
which caused memory bloat during C compilation.
This change factors out the assertion above to a function.
Now gcc consumes 160 MB instead of 250 MB to compile array.c.
|
|
The old code lost information of lineno. Now, an assertion error will
output a correct lineno (but now gcc 8 requires 250 MB, unfortunately).
|
|
The assertion blows up gcc 8 by consuming approx. 1.8 GB memory.
This change reduces the amount of memory required to about 200 MB.
A follow-up of ae750799c1b28b06d02e50cd26450b9903516526.
|
|
FL_TEST() uses FL_ABLE() which test data types. However,
in array.c we don't need to check it (all of them should be
T_ARRAY), so I changed from FL_TEST() to FL_TEST_RAW() which
does not check FL_ABLE(). Instead of FL_ABLE(), add assertion
to check given object is a T_ARRAY object.
For example, rb_ary_free() becomes slim:
with FL_TEST():
0000000000006a30 <rb_ary_free>:
6a30: 40 f6 c7 07 test $0x7,%dil
6a34: 48 8b 07 mov (%rdi),%rax
6a37: 75 09 jne 6a42 <rb_ary_free+0x12>
6a39: 48 f7 c7 f7 ff ff ff test $0xfffffffffffffff7,%rdi
6a40: 75 1e jne 6a60 <rb_ary_free+0x30>
6a42: a9 00 00 00 02 test $0x2000000,%eax
6a47: 74 07 je 6a50 <rb_ary_free+0x20>
6a49: f3 c3 repz retq
6a4b: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
6a50: 48 8b 7f 20 mov 0x20(%rdi),%rdi
6a54: e9 00 00 00 00 jmpq 6a59 <rb_ary_free+0x29>
6a59: 0f 1f 80 00 00 00 00 nopl 0x0(%rax)
6a60: 89 c2 mov %eax,%edx
6a62: 83 e2 1f and $0x1f,%edx
6a65: 83 fa 1b cmp $0x1b,%edx
6a68: 74 d8 je 6a42 <rb_ary_free+0x12>
6a6a: f6 c4 60 test $0x60,%ah
6a6d: 74 d3 je 6a42 <rb_ary_free+0x12>
6a6f: eb d8 jmp 6a49 <rb_ary_free+0x19>```
with FL_TEST_RAW():
0000000000006a30 <rb_ary_free>:
6a30: 48 f7 07 00 60 00 02 testq $0x2006000,(%rdi)
6a37: 74 07 je 6a40 <rb_ary_free+0x10>
6a39: f3 c3 repz retq
6a3b: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
6a40: 48 8b 7f 20 mov 0x20(%rdi),%rdi
6a44: e9 00 00 00 00 jmpq 6a49 <rb_ary_free+0x19>
|
|
|
|
Shared arrays created by Array#dup and so on points
a shared_root object to manage lifetime of Array buffer.
However, sometimes shared_root is called only shared so
it is confusing. So I fixed these wording "shared" to "shared_root".
* RArray::heap::aux::shared -> RArray::heap::aux::shared_root
* ARY_SHARED() -> ARY_SHARED_ROOT()
* ARY_SHARED_NUM() -> ARY_SHARED_ROOT_REFCNT()
Also, add some debug_counters to count shared array objects.
* ary_shared_create: shared ary by Array#dup and so on.
* ary_shared: finished in shard.
* ary_shared_root_occupied: shared_root but has only 1 refcnt.
The number (ary_shared - ary_shared_root_occupied) is meaningful.
|
|
RUBY_ASSERT_ALWAYS(expr) ignores NDEBUG (we cannot remove this
assertion).
|
|
Array#minmax was previous not implemented, so calling #minmax on
array was actually calling Enumerable#minmax. This is a simple
implementation of #minmax by just calling rb_ary_min and
rb_ary_max, which improves performance significantly.
Fixes [Bug #15929]
|
|
Fixes [Bug #15953]
Closes: https://github.com/ruby/ruby/pull/2253
|
|
Bug fix in commit ec8e5f5aa64e2a [Bug #15952] disabled an
optimization in this function.
Closes: https://github.com/ruby/ruby/pull/2252
|
|
Closes: https://github.com/ruby/ruby/pull/2251
|
|
Fixes [Bug #15951]
Closes: https://github.com/ruby/ruby/pull/2250
|
|
For array.c (Array#sort) and enum.c (Enumerable#sort_by),
add comments mentioning that sort.reverse! / sort_by { ... }.reverse!
can/should be used to reverse the result. [ci skip]
|
|
|
|
* Mostly to try the new git repository.
|
|
[Fix GH-2084]
|
|
* array.c (rb_ary_join_m): warn use of non-nil $,.
* io.c (rb_output_fs_setter): warn when set to non-nil value.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
[ruby-core:87945] [Feature #14912]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
Because hard to specify commits related to r67479 only.
So please commit again.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|