DEV Community

loading...

Discussion on: Performance Comparison, Rust vs Crystal with Redis

Collapse
jgaskins profile image
Jamie Gaskins Author

If it helps ease your mind, I ran the benchmark code against the other Crystal Redis client I linked in the article, which is not optimized for heap allocations the way mine is. The only differences in the benchmark code are s/::Connection// and s/pipeline/pipelined/. The code is otherwise identical. Here is the result:

$ time bin/bench_redis
00:00:00.354746110
bin/bench_redis  0.17s user 0.03s system 53% cpu 0.372 total
Enter fullscreen mode Exit fullscreen mode

Only about 8% slower overall and 42% slower at the CPU (200ms vs 140ms) for the "average" Crystal Redis client. If Rust and Crystal were actually closer in performance, this is the sort of difference in performance I expected. I actually expected Rust to be within ±30%, but I was off by an entire order of magnitude.