Sharon Rosner

@noteflakes
111 Followers
63 Following
74 Posts
Independent software consultant
GitHubhttps://github.com/noteflakes

More work on UringMachine benchmarks. This validates the work of @ioquatix on the fiber scheduler. We see a marked performance advantage to using Ruby fibers for any I/O-bound workload, including querying PostgreSQL databases.

https://github.com/digital-fabric/uringmachine/blob/main/benchmark/README.md

Just pushed some preliminary benchmarks measuring the performance of UringMachine against stock Ruby I/O, and the results are promising!

https://github.com/digital-fabric/uringmachine/tree/main/benchmark#readme

Ruby performance tricks: passing blocks to method calls in Ruby is so convenient and widespread, we tend to forget it has performance implications, in both CPU time and memory usage.

Case in point: if you need to do tight loops in your code, you might want to use `while` rather than `loop {}`. The performance difference is stagerring - `while` can be more than 3 times faster than `loop {}` (and with --yjit it's like 9x faster!)

benchmark code: https://gist.github.com/noteflakes/d48bb74737577d1e7e6ab3954270325a

#ruby #performance

Which is faster, loop or while?

Which is faster, loop or while? GitHub Gist: instantly share code, notes, and snippets.

Gist