Age | Commit message (Collapse) | Author |
|
In most of case `sort_by` works on primitive type.
Using `qsort_r` with function pointer is much slower than compare data directly.
I implement an intro sort which compare primitive data directly for `sort_by`.
We can even afford an O(n) type check before primitive data sort.
It still go faster.
Notes:
Merged: https://github.com/ruby/ruby/pull/7805
Merged-By: nobu <[email protected]>
|
|
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/7316
|
|
Prior to this commit the `OPTIMIZED_CMP` macro relied on a method lookup
to determine whether `<=>` was overridden. The result of the lookup was
cached, but only for the duration of the specific method that
initialized the cmp_opt_data cache structure.
With this method lookup, `[x,y].max` is slower than doing `x > y ?
x : y` even though there's an optimized instruction for "new array max".
(John noticed somebody a proposed micro-optimization based on this fact
in https://github.com/mastodon/mastodon/pull/19903.)
```rb
a, b = 1, 2
Benchmark.ips do |bm|
bm.report('conditional') { a > b ? a : b }
bm.report('method') { [a, b].max }
bm.compare!
end
```
Before:
```
Comparison:
conditional: 22603733.2 i/s
method: 19820412.7 i/s - 1.14x (± 0.00) slower
```
This commit replaces the method lookup with a new CMP basic op, which
gives the examples above equivalent performance.
After:
```
Comparison:
method: 24022466.5 i/s
conditional: 23851094.2 i/s - same-ish: difference falls within
error
```
Relevant benchmarks show an improvement to Array#max and Array#min when
not using the optimized newarray_max instruction as well. They are
noticeably faster for small arrays with the relevant types, and the same
or maybe a touch faster on larger arrays.
```
$ make benchmark COMPARE_RUBY=<master@5958c305> ITEM=array_min
$ make benchmark COMPARE_RUBY=<master@5958c305> ITEM=array_max
```
The benchmarks added in this commit also look generally improved.
Co-authored-by: John Hawthorn <[email protected]>
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6721
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6577
|
|
|
|
rb_ary_tmp_new suggests that the array is temporary in some way, but
that's not true, it just creates an array that's hidden and not on the
transient heap. This commit renames it to rb_ary_hidden_new.
Notes:
Merged: https://github.com/ruby/ruby/pull/6180
|
|
[Misc #18891]
Notes:
Merged: https://github.com/ruby/ruby/pull/6094
|
|
Restores doc for the methods that were cited in https://bugs.ruby-lang.org/issues/18765.
Notes:
Merged-By: BurdetteLamar <[email protected]>
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/5825
Merged-By: jeremyevans <[email protected]>
|
|
* Repair format and links in What's Here for Comparable and Array
* Repair format for What's Here in enum.c
Notes:
Merged-By: BurdetteLamar <[email protected]>
|
|
Previously, this would work as expected if the enumerable contained
0 or 1 element, and would raise LocalJumpError otherwise. That
inconsistent behavior is likely to lead to bugs.
Fixes [Bug #18635]
Notes:
Merged: https://github.com/ruby/ruby/pull/5690
|
|
I used this regex:
(?<=\[)#(?:class|module)-([A-Za-z]+)-label-([A-Za-z0-9\-\+]+)
And performed a global find & replace for this:
rdoc-ref:$1@$2
Notes:
Merged: https://github.com/ruby/ruby/pull/5530
|
|
|
|
A little more about the classes that include or extend Enumerable.
Notes:
Merged-By: BurdetteLamar <[email protected]>
|
|
This behavior changed in dfb47bbd17c3c2b8ce17dbafaf62df023b0224b2,
but only for normal exit, not for early exit. Fix it for early
exit as well.
While here, fix example code in documentation so that it doesn't
indicate that the method returns nil.
Notes:
Merged: https://github.com/ruby/ruby/pull/5129
|
|
Fixes [Bug #18289]
Notes:
Merged: https://github.com/ruby/ruby/pull/5086
|
|
Co-authored-by: Takashi Kokubun <[email protected]>
Co-authored-by: Nobuyoshi Nakada <[email protected]>
Notes:
Merged: https://github.com/ruby/ruby/pull/1509
Merged-By: nobu <[email protected]>
|
|
Code markup in RDoc must not be concatenated with anothr word.
|
|
Notes:
Merged-By: BurdetteLamar <[email protected]>
|
|
Treated:
#sum
#uniq
#compact
Notes:
Merged-By: BurdetteLamar <[email protected]>
|
|
Treats:
#slice_after
#slice_when
#chunk_while
Notes:
Merged-By: BurdetteLamar <[email protected]>
|
|
* Enhanced RDoc for Enumerable#slice_before
* Enhanced RDoc for Enumerable#slice_before
Notes:
Merged-By: BurdetteLamar <[email protected]>
|
|
Notes:
Merged-By: BurdetteLamar <[email protected]>
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/4925
Merged-By: nobu <[email protected]>
|
|
Treated:
#drop
#drop_while
#cycle
Notes:
Merged-By: BurdetteLamar <[email protected]>
|
|
Treats:
#zip
#take
#take_while
Notes:
Merged-By: BurdetteLamar <[email protected]>
|
|
Treats:
#each_with_index
#reverse_each
#each_entry
#each_slice
#each_cons
#each_with_object
Notes:
Merged-By: BurdetteLamar <[email protected]>
|
|
Treats:
#min
#max
#minmax
#min_by
#max_by
#minmax_by
#include?
Notes:
Merged-By: BurdetteLamar <[email protected]>
|
|
Treated:
#none?
#one?
#min
Notes:
Merged-By: BurdetteLamar <[email protected]>
|
|
Treats:
#partition
#group_by
#tally
#first
#sort
#sort_by
#all?
#any?
Notes:
Merged-By: BurdetteLamar <[email protected]>
|
|
Notes:
Merged-By: BurdetteLamar <[email protected]>
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/4805
|
|
#to_a
#to_h
#inject
Notes:
Merged-By: BurdetteLamar <[email protected]>
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/4684
|
|
Methods treated:
#count
#find
#find_index
#select
#filter_map
#reject
#map
#flat_map
Notes:
Merged-By: BurdetteLamar <[email protected]>
|
|
Enhanced RDoc for Enumerable: #grep and #grep_v.
Notes:
Merged-By: BurdetteLamar <[email protected]>
|
|
* Add test cases for Enumerable#tally with hash argument
* Add ruby/spec for Enumerable#tally with hash argument
* Fix Enumerable#tally does not update given frozen hash
* Add test cases for Enumerable#tally with hash convertible arguments
* Fix SEGV when Enumerable#tally takes non Hash convertible
* FIx cosmetic damage enum.c
Notes:
Merged: https://github.com/ruby/ruby/pull/4327
Merged-By: nobu <[email protected]>
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/4318
Merged-By: nobu <[email protected]>
|
|
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/4288
|
|
Iteration per second (i/s)
| |compare-ruby|built-ruby|
|:------|-----------:|---------:|
|tally | 52.814| 114.936|
| | -| 2.18x|
Notes:
Merged: https://github.com/ruby/ruby/pull/4278
|
|
* RDoc: Enhanced introduction for Enumerable
* RDoc: Enhanced introduction for Enumerable
* RDoc: Enhanced introduction for Enumerable
Notes:
Merged-By: marcandre <[email protected]>
|
|
Suggested by @hanachin at
https://github.com/rurema/doctree/pull/2425#discussion_r551327592
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3851
|
|
|
|
[Bug #17030]
Notes:
Merged: https://github.com/ruby/ruby/pull/3868
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3691
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3738
|