summaryrefslogtreecommitdiff
path: root/benchmark
AgeCommit message (Collapse)Author
2019-09-28Optimize Array#flatten and flatten! for already flattened arrays (#2495)Dylan Thacker-Smith
* Optimize Array#flatten and flatten! for already flattened arrays * Add benchmark for Array#flatten and Array#flatten! [Bug #16119]
2019-09-26Reduce ISeq size of mjit_exec benchmarkTakashi Kokubun
to avoid unwanted memory pressure
2019-09-26Add special runner to benchmark mjit_execTakashi Kokubun
I wanted to dynamically generate benchmark cases to test various number of methods. Thus I added a dedicated runner of benchmark-driver.
2019-09-21Add a benchmark for JIT-ed code dispatchTakashi Kokubun
2019-09-19reuse cc->call卜部昌平
I noticed that in case of cache misshit, re-calculated cc->me can be the same method entry than the pevious one. That is an okay situation but can't we partially reuse the cache, because cc->call should still be valid then? One thing that has to be special-cased is when the method entry gets amended by some refinements. That happens behind-the-scene of call cache mechanism. We have to check if cc->me->def points to the previously saved one. Calculating ------------------------------------- trunk ours vm2_poly_same_method 1.534M 2.025M i/s - 6.000M times in 3.910203s 2.962752s Comparison: vm2_poly_same_method ours: 2025143.9 i/s trunk: 1534447.2 i/s - 1.32x slower Notes: Merged: https://github.com/ruby/ruby/pull/2468
2019-09-02Add a benchmark for opt_regexpmatch2Takashi Kokubun
vm2_regexp was for opt_regexpmatch1.
2019-08-10Close created files [ci skip]Nobuyoshi Nakada
2019-08-10Fix typo in comment [ci skip]Masato Ohba
s/Thtread/Thread
2019-08-05n+1 to include n in rangeYaw Boakye
Python's range stop right before n, which means factL never returns the correct result. Closes: https://github.com/ruby/ruby/pull/1982
2019-08-02Revert "Revert "Add a specialized instruction for `.nil?` calls""Yusuke Endoh
This reverts commit a0980f2446c0db735b8ffeb37e241370c458a626. Retry for macOS Mojave.
2019-08-02Revert "Add a specialized instruction for `.nil?` calls"Yusuke Endoh
This reverts commit 9faef3113fb4331524b81ba73005ba13fa0ef6c6. It seemed to cause a failure on macOS Mojave, though I'm unsure how. https://rubyci.org/logs/rubyci.s3.amazonaws.com/osx1014/ruby-master/log/20190802T034503Z.fail.html.gz This tentative revert is to check if the issue is actually caused by the change or not.
2019-07-31Add a specialized instruction for `.nil?` callsAaron Patterson
This commit adds a specialized instruction for called to `.nil?`. It is about 27% faster than master in the case where the object is nil or not nil. In the case where an object implements `nil?`, I think it may be slightly slower. Here is a benchmark: ```ruby require "benchmark/ips" class Niller def nil?; true; end end not_nil = Object.new xnil = nil niller = Niller.new Benchmark.ips do |x| x.report("nil?") { xnil.nil? } x.report("not nil") { not_nil.nil? } x.report("niller") { niller.nil? } end ``` On Ruby master: ``` [aaron@TC ~/g/ruby (master)]$ ./ruby compil.rb Warming up -------------------------------------- nil? 429.195k i/100ms not nil 437.889k i/100ms niller 437.935k i/100ms Calculating ------------------------------------- nil? 20.166M (± 8.1%) i/s - 100.002M in 5.002794s not nil 20.046M (± 7.6%) i/s - 99.839M in 5.020086s niller 22.467M (± 6.1%) i/s - 112.111M in 5.013817s [aaron@TC ~/g/ruby (master)]$ ./ruby compil.rb Warming up -------------------------------------- nil? 449.660k i/100ms not nil 433.836k i/100ms niller 443.073k i/100ms Calculating ------------------------------------- nil? 19.997M (± 8.8%) i/s - 99.375M in 5.020458s not nil 20.529M (± 7.0%) i/s - 102.385M in 5.020689s niller 21.796M (± 8.0%) i/s - 108.110M in 5.002300s [aaron@TC ~/g/ruby (master)]$ ./ruby compil.rb Warming up -------------------------------------- nil? 402.119k i/100ms not nil 438.968k i/100ms niller 398.226k i/100ms Calculating ------------------------------------- nil? 20.050M (±12.2%) i/s - 98.519M in 5.008817s not nil 20.614M (± 8.0%) i/s - 102.280M in 5.004531s niller 22.223M (± 8.8%) i/s - 110.309M in 5.013106s ``` On this branch: ``` [aaron@TC ~/g/ruby (specialized-nilp)]$ ./ruby compil.rb Warming up -------------------------------------- nil? 468.371k i/100ms not nil 456.517k i/100ms niller 454.981k i/100ms Calculating ------------------------------------- nil? 27.849M (± 7.8%) i/s - 138.169M in 5.001730s not nil 26.417M (± 8.7%) i/s - 131.020M in 5.011674s niller 21.561M (± 7.5%) i/s - 107.376M in 5.018113s [aaron@TC ~/g/ruby (specialized-nilp)]$ ./ruby compil.rb Warming up -------------------------------------- nil? 477.259k i/100ms not nil 428.712k i/100ms niller 446.109k i/100ms Calculating ------------------------------------- nil? 28.071M (± 7.3%) i/s - 139.837M in 5.016590s not nil 25.789M (±12.9%) i/s - 126.470M in 5.011144s niller 20.002M (±12.2%) i/s - 98.144M in 5.001737s [aaron@TC ~/g/ruby (specialized-nilp)]$ ./ruby compil.rb Warming up -------------------------------------- nil? 467.676k i/100ms not nil 445.791k i/100ms niller 415.024k i/100ms Calculating ------------------------------------- nil? 26.907M (± 8.0%) i/s - 133.755M in 5.013915s not nil 25.319M (± 7.9%) i/s - 125.713M in 5.007758s niller 19.569M (±11.8%) i/s - 96.286M in 5.008533s ``` Co-Authored-By: Ashe Connor <kivikakk@github.com>
2019-07-20Explain what's benchmark/lib/load.rb [ci skip]Takashi Kokubun
I'm actually not using this, but ko1 is.
2019-07-18Add note about setting `vm.max_map_count` for Linux.Samuel Williams
2019-07-18Add benchmark to help diagnose performance regression.Samuel Williams
See https://bugs.ruby-lang.org/issues/16009 for more details.
2019-07-12* remove trailing spaces.Nobuyoshi Nakada
2019-07-12Improved fiber benchmarks. Increase number of iterations.Samuel Williams
2019-07-02Adjust memory_status.rb under the tool directory.Hiroshi SHIBATA
2019-07-01Use realpath(3) instead of custom realpath implementation if availableJeremy Evans
This approach is simpler than the previous approach which tries to emulate realpath(3). It also performs much better on both Linux and OpenBSD on the included benchmarks. By using realpath(3), we can better integrate with system security features such as OpenBSD's unveil(2) system call. This does not use realpath(3) on Windows even if it exists, as the approach for checking for absolute paths does not work for drive letters. This can be fixed without too much difficultly, though until Windows defines realpath(3), there is no need to do so. For File.realdirpath, where the last element of the path is not required to exist, fallback to the previous approach, as realpath(3) on most operating systems requires the whole path be valid (per POSIX), and the operating systems where this isn't true either plan to conform to POSIX or may change to conform to POSIX in the future. glibc realpath(3) does not handle /path/to/file.rb/../other_file.rb paths, returning ENOTDIR in that case. Fallback to the previous code if realpath(3) returns ENOTDIR. glibc doesn't like realpath(3) usage for paths like /dev/fd/5, returning ENOENT even though the path may appear to exist in the filesystem. If ENOENT is returned and the path exists, then fall back to the default approach.
2019-06-19Improve benchmarks and tests for threads.Samuel Williams
2019-06-10Make sure to suppress .irbrc on benchmarkTakashi Kokubun
By the way, this is already improved by nobu: ``` $ benchmark-driver benchmark/irb_exec.yml --rbenv '2.6.3;2.7.0-preview1;before;after' -v 2.6.3: ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux] 2.7.0-preview1: ruby 2.7.0preview1 (2019-05-31 trunk c55db6aa271df4a689dc8eb0039c929bf6ed43ff) [x86_64-linux] before: ruby 2.7.0dev (2019-06-10T21:13:14+09:00 master 973fd18f11) [x86_64-linux] after: ruby 2.7.0dev (2019-06-10T21:18:56+09:00 master 976c689ad4) [x86_64-linux] Calculating ------------------------------------- 2.6.3 2.7.0-preview1 before after irb_exec 11.868 5.872 6.297 10.278 i/s - 30.000 times in 2.527776s 5.108997s 4.764167s 2.918821s Comparison: irb_exec 2.6.3: 11.9 i/s after: 10.3 i/s - 1.15x slower before: 6.3 i/s - 1.88x slower 2.7.0-preview1: 5.9 i/s - 2.02x slower ```
2019-06-10Add a benchmark of irb boot timeTakashi Kokubun
``` $ benchmark-driver benchmark/irb_exec.yml --rbenv '2.6.3;2.7.0-preview1' Calculating ------------------------------------- 2.6.3 2.7.0-preview1 irb_exec 11.844 5.171 i/s - 30.000 times in 2.532887s 5.801960s Comparison: irb_exec 2.6.3: 11.8 i/s 2.7.0-preview1: 5.2 i/s - 2.29x slower ```
2019-06-05Optimize CGI.escapeHTML by reducing buffer extensionTakashi Kokubun
and switch-case branches. Buffer allocation optimization using `ALLOCA_N` would be the main benefit of patch. It eliminates the O(N) buffer extensions. It also reduces the number of branches using escape table like https://mattn.kaoriya.net/software/lang/c/20160817011915.htm. Closes: https://github.com/ruby/ruby/pull/2226 Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Co-authored-by: Yasuhiro MATSUMOTO <mattn.jp@gmail.com>
2019-06-05Revert "Optimize CGI.escapeHTML by reducing buffer extension"Takashi Kokubun
This reverts commit 8d81e59aa7a62652caf85f9c8db371703668c149. `ALLOCA_N` does not check stack overflow unlike ALLOCV. I'll fix it and re-commit it again.
2019-06-05Optimize CGI.escapeHTML by reducing buffer extensionTakashi Kokubun
and switch-case branches. Buffer allocation optimization using `ALLOCA_N` would be the main benefit of patch. It eliminates the O(N) buffer extensions. It also reduces the number of branches using escape table like https://mattn.kaoriya.net/software/lang/c/20160817011915.htm. Closes: https://github.com/ruby/ruby/pull/2226 Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Co-authored-by: Yasuhiro MATSUMOTO <mattn.jp@gmail.com>
2019-06-01Add a benchmark using IRB::ColorTakashi Kokubun
I heard actually this part would not be a bottleneck for rendering because writing anything to terminal takes way longer time anyway, but I thought this benchmark script might be useful for benchmarking Ruby itself.
2019-05-07Reduce ONIG_NREGION from 10 to 4: power of 2 and testing revealed most ↵Lourens Naudé
pattern matches are less than or equal to 4 results Closes: https://github.com/ruby/ruby/pull/2135
2019-05-03Improve performance of case-conversion methodsNobuyoshi Nakada
2019-04-17string.c: improve splitting into charsnobu
* string.c (rb_str_split_m): improve splitting into chars by an empty string, without a regexp. Comparison: to_chars-1 built-ruby: 1273527.6 i/s compare-ruby: 189423.3 i/s - 6.72x slower to_chars-10 built-ruby: 120993.5 i/s compare-ruby: 37075.8 i/s - 3.26x slower to_chars-100 built-ruby: 15646.4 i/s compare-ruby: 4012.1 i/s - 3.90x slower to_chars-1000 built-ruby: 1295.1 i/s compare-ruby: 408.5 i/s - 3.17x slower git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-21benchmark/app_aobench.rb: complete commented code to write the image to a fileeregon
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-21benchmark/app_aobench.rb: remove extra printf argumentseregon
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-21benchmark/app_aobench.rb: move `srand(0)` at the toperegon
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-21benchmark/app_aobench.rb: add `srand(0)`mame
To prevent noise for benchmark result. Just for the case. [Bug #15552] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-21benchmark/app_aobench.rb: add a magic commentmame
To support the change of default encoding. It had not worked correctly since 2.0 :-) [Bug #15552] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-07Time.strptime benchmarksnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-06benchmark/range_last.yml: remove needless preludemrkn
[ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-06benchmark/range_last.yml: add benchmark casesmrkn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-05benchmark/range_last.yml: add a benchmark of Range#lastmrkn
[ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-01benchmark/complex_float_*.yml: New benchmarksmrkn
Add new benchmark scripts for binary operations of Complex with float components. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-27delete emacs mode lines [ci skip]shyouhei
These settings are now covered by .dir-locals.el. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-22benchmark/app_erb.yml: remove unused variablek0kubun
https://github.com/ruby/ruby/commit/3efcb74036af32cbcc889d06d8c6c546289e89f4#r31762996 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-06Add benchmark for hash small literalstenderlove
Co-Authored-By: Krzysztof Rybka <krzysztof.rybka@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20Rename fiber chain benchmark.samuel
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20* remove trailing spaces.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20Remove `Benchmark` times.samuel
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20Better benchmark name.samuel
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20* remove trailing spaces.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20Fix broken benchmarksamuel
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20* remove trailing spaces.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20Fix code climate cognitive complexity issuesamuel
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e