Sanjiv has drawn a good raw loop performance comparison between Go, Rust, C and Dlang. Some of the outcomes are pretty fascinating and he predicts that Rust will be a great for low level and system programming while Go will take the lead for general purpose high level languages.
Did you know – In ruby, ‘while’ loop performs much better than ‘for’. It is recommended that when iterating large data,use ‘while’ or ‘loop’ than the traditional each or foreach.
We have been learning & working on various programmings languages. These different programmings language help us to learn various programming paradigm & constructs. There are number of new programming language such golang, rust, dlang.
We are going to see performance of simple loop in golang, rust, dlang, ruby. We are going iterate a 100 million times to see raw performance. Below is the example of for loop in golang.
Above code is compiled with gccgo-4.9(golang). gccgo compile the given input file & produces binary file with name ‘a.out’.Benchmark of following code:
Below is the example of loop in rust-lang. In rust lang, there are two different looping construct namely ‘for’ and
‘while’ loop. ‘while’ denotes a loop that iterates as long as its given condition.
Above code is compiled with rust(version 0.13). rustc compile the given input file & produce binary file with name same name as input.Benchmark of following code:
Below…
View original post 239 more words