Get the latest tech news

Speeding up Ruby by rewriting C in Ruby


There is a recent language comparison repo which has been getting shared a lot. In it, CRuby was the third slowest option, only beating out R and Python. The repo author, @BenjDicken, created a fun visualization of each language’s performance. Here’s one of the visualizations, which shows Ruby as the third slowest language benchmarked: The code for this visualization is from https://benjdd.com/languages/, with permission from @BenjDicken The repository describes itself as:

The programming world loves microbenchmarks 🤷‍♂️ Having a fast benchmark may not be valuable in practice but it has meaning for people’s interest in a language. When writing general Ruby programs we typically don’t and shouldn’t consider the impact of one versus two machine code instructions. LoopsRange#each25.57sInteger#times13.66sArray#each13.96s I’ve forked the original language implementation repo, and created my own repository called “Ruby Microbench”.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of ruby

ruby

Related news:

News photo

Calculating the largest known prime in Ruby

News photo

How we made a Ruby method 200x faster

News photo

Optimize Database Performance in Ruby on Rails and ActiveRecord