8000 Ruby benchmarks by raviqqe · Pull Request #2511 · raviqqe/stak · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Ruby benchmarks #2511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bench/src/add/main.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x = 1 + 2 + 3
1 change: 1 addition & 0 deletions bench/src/empty/main.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

9 changes: 9 additions & 0 deletions bench/src/eval/main.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
eval("
y = 0

(0..10000000).each do |x|
y += x
end

print(y)
")
5 changes: 5 additions & 0 deletions bench/src/fibonacci/main.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def fibonacci(x)
x < 2 ? x : fibonacci(x - 1) + fibonacci(x - 2)
end

p(fibonacci(32))
1 change: 1 addition & 0 deletions bench/src/hello/main.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puts("Hello, world!")
7 changes: 7 additions & 0 deletions bench/src/sum/main.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
y = 0

(0..10000000).each do |x|
y += x
end

print(y)
9 changes: 9 additions & 0 deletions bench/src/tak/main.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
def tak(x, y, z)
if y < x
tak(tak(x - 1, y, z), tak(y - 1, z, x), tak(z - 1, x, y))
else
z
end
end

p(tak(16, 8, 0))
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"mlua",
"mmap",
"mmaps",
"mruby",
"mrun",
"mstak",
"munmap",
Expand Down
4 changes: 2 additions & 2 deletions tools/bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ setup() {

feature=$1

brew install chibi-scheme gambit-scheme gauche guile lua micropython
brew install chibi-scheme gambit-scheme gauche guile lua micropython mruby ruby
cargo install hyperfine

case $feature in
Expand Down Expand Up @@ -76,7 +76,7 @@ for file in $(ls */main.scm | sort | grep $filter); do

if [ -r $base.py ]; then
reference="python3 $base.py"
scripts="micropython $base.py,lua $base.lua,$scripts"
scripts="micropython $base.py,ruby $base.rb,mruby $base.rb,lua $base.lua,$scripts"
fi

hyperfine \
Expand Down
Loading
0