Red vs. Green - vs. the Developer!
Posted: Sat Dec 14, 2013 7:20 pm
Hi All,
There's been quite a bit of speculation about whether Ruby can out-perform the old green trigger system. The funky new stuff is cool - but should we re-write all our existing modules to get a turbo boost in performance?
So I decided to do a concrete test on a specific example - filling an array with some values that tale a moderate amount of maths to work out. As I had the timers out for this, the project also turned into a bit of challenge - to pit Ruby against Green, and also both of them against some tried and tested optimisation techniques.
So this is both a benchmark test and a tutorial - the same algorithm, in Ruby and in 'Green', optimised in parallel.
It's also a first outing for a new style of tutorial that I'm trying out - a schematic file, with various little widgets to help you find your way around, where there are live components to play with and not just a load of text to read (you will need to scroll a lot, though!)...
The readings in the time boxes when you load the schematic will be those from my Q6700 desktop - not exactly the newest machine around. You can change the size of the test in order to get meaningful results, as the time resolution is dependent on the trigger system and the real time clock resolution of 1ms.
Before testing with larger loop counts, be sure to make a backup of the file - large counts can cause a Ruby time-out which will lock out every single Ruby object in the schematic! It's a real PITA to unlock them all again, so a 'vanilla' file on disk is highly recommended!!
There's been quite a bit of speculation about whether Ruby can out-perform the old green trigger system. The funky new stuff is cool - but should we re-write all our existing modules to get a turbo boost in performance?
So I decided to do a concrete test on a specific example - filling an array with some values that tale a moderate amount of maths to work out. As I had the timers out for this, the project also turned into a bit of challenge - to pit Ruby against Green, and also both of them against some tried and tested optimisation techniques.
So this is both a benchmark test and a tutorial - the same algorithm, in Ruby and in 'Green', optimised in parallel.
It's also a first outing for a new style of tutorial that I'm trying out - a schematic file, with various little widgets to help you find your way around, where there are live components to play with and not just a load of text to read (you will need to scroll a lot, though!)...
The readings in the time boxes when you load the schematic will be those from my Q6700 desktop - not exactly the newest machine around. You can change the size of the test in order to get meaningful results, as the time resolution is dependent on the trigger system and the real time clock resolution of 1ms.
Before testing with larger loop counts, be sure to make a backup of the file - large counts can cause a Ruby time-out which will lock out every single Ruby object in the schematic! It's a real PITA to unlock them all again, so a 'vanilla' file on disk is highly recommended!!