Skip to content
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

Crystal is much slower in recent releases #9198

Closed
renich opened this issue Apr 28, 2020 · 5 comments
Closed

Crystal is much slower in recent releases #9198

renich opened this issue Apr 28, 2020 · 5 comments

Comments

@renich
Copy link

renich commented Apr 28, 2020

Please, check this one out: https://gitlab.com/renich/benchmarks/-/jobs/493556257#L127. Crystal's test starts at line: 142. It used to be much faster than even C when printing 1_000_000 lines. Now, it's not.

My latest (local) result:

gcc -o one_million_c one_million.c > /dev/null
time ./one_million_c > /dev/null

real	0m0.068s
user	0m0.066s
sys	0m0.002s
echo

g++ -o one_million_cpp one_million.cpp > /dev/null
time ./one_million_cpp > /dev/null

real	0m0.115s
user	0m0.113s
sys	0m0.002s
echo

crystal build --release -o one_million_cr one_million.cr
time ./one_million_cr > /dev/null

real	0m0.353s
user	0m0.158s
sys	0m0.196s
echo

This started with v0.34.0... I think. It could've been v0.33.00.

In any case, I don't even know if this is a bug or not. Just wanted to report it.

I hope you fix it... otherwise, the days of bragging about this are gone: https://twitter.com/Renich/status/1138838599397519360 😢

Even @asterite commented on it! ;D

@j8r
Copy link
Contributor

j8r commented Apr 28, 2020

This are real-world benchmarks! 😄
Try setting STDOUT.flush_on_newline = false before printing.

@asterite
Copy link
Member

Hi! @j8r is right. Please see #8935

@renich
Copy link
Author

renich commented Apr 29, 2020

Right! We're back at beating C! ;D

[renich@introdesk one_million]$ make
gcc -o one_million_c one_million.c > /dev/null
time ./one_million_c > /dev/null

real	0m0.068s
user	0m0.067s
sys	0m0.001s
echo

g++ -o one_million_cpp one_million.cpp > /dev/null
time ./one_million_cpp > /dev/null

real	0m0.112s
user	0m0.112s
sys	0m0.000s
echo

crystal build --release -o one_million_cr one_million.cr
time ./one_million_cr > /dev/null

real	0m0.041s
user	0m0.040s
sys	0m0.003s
echo

go build -o one_million_go one_million.go
time ./one_million_go > /dev/null

real	0m0.356s
user	0m0.267s
sys	0m0.091s
echo

javac one_million.java
time java OneMillion > /dev/null

real	0m0.476s
user	0m0.562s
sys	0m0.139s
echo

time node one_million.js > /dev/null

real	0m2.821s
user	0m2.678s
sys	0m0.154s
echo

time perl one_million.pl > /dev/null

real	0m0.119s
user	0m0.111s
sys	0m0.004s
echo

time php one_million.phps > /dev/null

real	0m0.233s
user	0m0.134s
sys	0m0.088s
echo

time python2 one_million.py > /dev/null

real	0m0.663s
user	0m0.634s
sys	0m0.015s
echo

time python3 one_million.py3 > /dev/null

real	0m0.521s
user	0m0.518s
sys	0m0.002s
echo

time perl6 one_million.p6 > /dev/null

real	0m2.605s
user	0m2.608s
sys	0m0.025s
time ruby one_million.rb > /dev/null

real	0m0.799s
user	0m0.774s
sys	0m0.010s
echo

rustc -o one_million_rust one_million.rs > /dev/null
time ./one_million_rust > /dev/null

real	0m0.330s
user	0m0.248s
sys	0m0.081s

Yeah, I know it's not much of a benchmark. But it does some basic dereferencing and a loop. Pretty much what my coding, at least, is all about. 😅

@jhass
Copy link
Member

jhass commented Apr 29, 2020

So... issue closed? :D

@renich
Copy link
Author

renich commented Apr 29, 2020

Well, yeah. I think. Thanks.

@renich renich closed this as completed Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants