Commit Graph

33 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto ed84649fbd benchmark: add VM optimization benchmarks
Add comprehensive benchmarks for measuring VM performance:
- vm_optimization_bench.rb: Ruby-level benchmarks covering dispatch,
  arithmetic, method calls, array/hash access, loops, and recursion
- vm_dispatch_bench.c: C-level micro-benchmarks for precise measurement

These benchmarks are designed to measure the effect of potential VM
optimizations such as tail-call threading, register variables,
fused opcodes, and inline caching.

Usage:
  # Ruby benchmark
  ./build/host/bin/mruby benchmark/vm_optimization_bench.rb

  # C benchmark
  cc -O2 -I include -I build/host/include \
     benchmark/vm_dispatch_bench.c \
     build/host/lib/libmruby.a -lm -o vm_dispatch_bench
  ./vm_dispatch_bench

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-27 14:57:24 +09:00
Yukihiro "Matz" Matsumoto b8f05f0752 benchmark: optimize bm_so_mandelbrot.rb
Replace for..in loops with while loops to avoid closure overhead.
Cache constants in local variables to avoid repeated lookups.
59% faster (7.4s -> 3.0s).

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-29 12:28:02 +09:00
Yukihiro "Matz" Matsumoto 8a5283cf4e benchmark: terminal version of mandelbrot
Optimized to avoid Math.sqrt by squaring the threshold
(sqrt(x) < 1000 => x < 1000000) and caching zr*zr/zi*zi
to avoid redundant computation. 29% faster than naive version.

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-29 11:56:58 +09:00
Yukihiro "Matz" Matsumoto 166262243a benchmark/bm_so_mandelbrot.rb: add new benchmark 2024-08-18 23:11:29 +09:00
John Bampton d86f4d220f benchmark: remove duplicate method calls
DuplicateMethodCall: Scene#render calls 'nsf * nsf' 3 times
2023-02-25 15:22:49 +10:00
John Bampton 41572d71b6 Remove blank line from the top of Ruby files 2022-12-29 14:29:48 +10:00
John Bampton 2438195289 ruby: remove unneeded parenthesis from methods
commit eeb33da43035b5400f8d1830ea52a68691b3a678
Author: John Bampton <jbampton@gmail.com>
Date:   Mon Oct 31 23:53:43 2022 +1000

    Fix up

commit 80923c8f92a58b2f33a36d6403de7f6341973110
Merge: bc89500f6 416f012f6
Author: John Bampton <jbampton@users.noreply.github.com>
Date:   Mon Oct 31 20:12:59 2022 +1000

    Merge branch 'master' into ruby-remove-parenthesis

commit bc89500f6357c453b457516452ffcc7fd03fee88
Author: John Bampton <jbampton@gmail.com>
Date:   Mon Oct 31 14:39:20 2022 +1000

    ruby: remove unneeded parenthesis from methods
2022-11-01 00:25:09 +10:00
Yukihiro "Matz" Matsumoto f7c2b0388a benchmark/bm_so_lists.rb: address the broken link; close #5737
The original page was lost, so we added the link to the wayback machine.
2022-06-28 11:31:16 +09:00
aoki1980taichi ad1d35c342 delete unused variable
cnt is unused
2022-06-25 00:21:23 +09:00
aoki1980taichi 4332f56056 delete unnecessary code
"else 0.0" is not used
2022-06-24 19:22:28 +09:00
aoki1980taichi ad8286c447 fix typo otherBasis -> orthoBasis
The original function name in ao.c was orthoBasis.
I guess the function is generating orthonormal basis (https://en.wikipedia.org/wiki/Orthonormal_basis).
2022-06-24 06:26:58 +09:00
Yukihiro "Matz" Matsumoto d01707d4cf benchmark/bm_ao_render.rb: enable specifying the size of the image. 2021-12-13 10:29:16 +09:00
Yukihiro "Matz" Matsumoto 856ae52021 bm_ao_rendar.rb: use instance variables instead of class variables.
Class variables are slower than instance variables of classes.
2021-12-06 21:12:23 +09:00
Yukihiro "Matz" Matsumoto f314a5132e Remove unused build configuration file benchmark/build_config_cc.rb. 2021-06-24 13:13:59 +09:00
John Bampton 9d32d440eb feat(CI): add the GitHub Super Linter
The GitHub Super Linter is a more robust and better supported
tool than the current GitHub Actions we are using.

Running these checks:

ERROR_ON_MISSING_EXEC_BIT: true
VALIDATE_BASH: true
VALIDATE_BASH_EXEC: true
VALIDATE_EDITORCONFIG: true
VALIDATE_MARKDOWN: true
VALIDATE_SHELL_SHFMT: true
VALIDATE_YAML: true

https://github.com/marketplace/actions/super-linter
https://github.com/github/super-linter

Added the GitHub Super Linter badge to the README.

Also updated the pre-commit framework and added
more documentation on pre-commit.

Added one more pre-commit check: check-executables-have-shebangs

Added one extra check for merge conflicts to our
GitHub Actions.

EditorConfig and Markdown linting.

Minor grammar and spelling fixes.

Update linter.yml
2021-04-16 16:37:52 +09:00
John Bampton 15f7b0182d chore: fix spelling 2021-03-07 04:58:15 +10:00
John Bampton 940dec5e7d Fix spelling 2020-12-13 18:38:22 +10:00
Yukihiro "Matz" Matsumoto b2398879fa Avoid including limits.h and stdint.h before mruby.h.
They are included from `mruby.h` anyway, and including it ahead can
cause some errors regarding `INT32_MAX` etc. with C++ compiler.
2020-10-12 16:21:18 +09:00
KOBAYASHI Shuji f54262776e [ci skip] Remove no meaning statement in bm_app_lc_fizzbuzz.rb 2019-01-23 21:19:39 +09:00
Yukihiro "Matz" Matsumoto b4f9b031de Some cosmetic changes 2017-11-22 16:09:50 +09:00
furunkel ed03b17bb4 Remove benchmarks not in mruby 2015-04-24 22:10:11 +02:00
furunkel 6110b385a7 Output PNG instead of PDF 2015-04-24 21:58:27 +02:00
furunkel 105f1f38a9 Add some of MRI's benchmarks 2015-04-24 19:34:39 +02:00
furunkel 01ee28d89d Rename 2015-04-24 14:22:43 +02:00
furunkel 8f5ec1a60f Let all benchmarks start with bm_ 2015-04-24 14:19:51 +02:00
furunkel 465d7a23c8 Add build files for benchmarkings; add mandelbrot benchmark 2015-04-24 13:40:54 +02:00
furunkel a96b871c46 Add task for running and plotting benchmarks 2015-04-23 22:27:19 +02:00
Miura Hideki 8f883e5b20 update outdated links to the original program. 2014-09-16 20:08:47 +09:00
Yukihiro "Matz" Matsumoto 7ea8803e06 add benchmark/bm_app_lc_fizzbuzz.rb 2014-09-10 10:09:34 +09:00
Yukihiro "Matz" Matsumoto 902a4da271 remove execution bit from benchmark/fib39.rb 2014-09-08 14:24:53 +09:00
Masaki Muranaka 35ced975dc Add fib39.rb to benchmark/ 2013-04-01 09:46:18 +09:00
Yukihiro Matsumoto 1314c59295 space and newline reformatting 2012-07-31 19:34:52 +09:00
Yukihiro Matsumoto e064ff2098 add some benchmark programs 2012-07-31 19:00:52 +09:00