An update on Crystal performance

At the beginning of 2022, I published a series of articles about a Crystal implementation for the Monkey Langauge.

I’m happy to report that My implementation compiled with Crystal 1.6.2 is much faster than the Go Version.

Update: Dec 23 2022:
@jgaskins gave me a good Christmas gift, and now Crystal 1.6.2 is faster in both Interpreted and VM modes than Go 1.19. I’ll write an update on my blog


Thanks so much for that writeup! It’s great to see benchmarks for something more broad than synthetic math things.

Just a nit, it’d be great if the post had some pretty graphs to summarize the results. It’s a little hard to follow with just the raw data spread across a few different embeds.



That is a good idea. Let me see what I can do about it

1 Like

I can recommend hyperfine for some easy benchmarking. It can output JSON data that can be used to make boxplots. Also the “time” command can be used to show the max RSS of a process (which I’ve found to be impressively low in my Crystal programs, although they’re mostly just toys and Advent of Code solutions).

Just posted a PR with a couple small tweaks to get the Crystal VM implementation to be slightly faster than its counterpart in Go.

1 Like

I’m using hyperfine already but just the plain output. I’ll have a look into the other output options

Thanks for your contribution. I’ll have a look.

I think that I can squeeze a little bit of performance in the interpreter as well

1 Like

I tested on a Linux VM with an AMD Ryzen, and Crystal 1.6.2 (with @jgaskins changes) is faster than Go 1.19 but slower than Go 1.17 (Not for much).

I guess that Go had a performance regression between 1.18 and 1.19, 1.18 being the version where they introduced Generics.

1 Like