diff options
| author | Jean Boussier <jean.boussier@gmail.com> | 2022-06-29 10:35:41 +0200 |
|---|---|---|
| committer | Jean Boussier <jean.boussier@gmail.com> | 2022-07-19 10:41:40 +0200 |
| commit | 0ae8dbbee0631721e820e29d0a613485cdcb3507 (patch) | |
| tree | ca3159a389e5480c1135167f7282363eb6bfdb1f /spec/ruby/core/array/shared/intersection.rb | |
| parent | ee1d2b276abbf6b03d862952a949302672a470a9 (diff) | |
rb_str_buf_append: fastpath to str_buf_cat
If the LHS is ASCII compatible and the RHS is 7BIT
we can directly concat without being concerned about
anything else.
Benchmark:
```
compare-ruby: ruby 3.2.0dev (2022-07-12T15:01:11Z master 71aec68566) [arm64-darwin21]
built-ruby: ruby 3.2.0dev (2022-07-13T10:13:53Z faster-buffer-conc.. a04c10476d) [arm64-darwin21]
warming up...
| |compare-ruby|built-ruby|
|:---------------------|-----------:|---------:|
|binary_append_utf8 | 385.315k| 573.663k|
| | -| 1.49x|
|binary_append_binary | 446.579k| 574.898k|
| | -| 1.29x|
|utf8_append_utf8 | 430.936k| 573.394k|
| | -| 1.33x|
```
Note that in the benchmark, the RHS always have a precomputed
coderange. So the benchmark never enter the slowpath of having to
scan the RHS. However it's extremly likely that we'll end
up scanning it anyway in rb_enc_cr_str_buf_cat
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6120
Diffstat (limited to 'spec/ruby/core/array/shared/intersection.rb')
0 files changed, 0 insertions, 0 deletions
