Programming Languages – Simple Speed Test

swift-heroI wrote a very basic speed test in SwiftJavaJavaScript, C / C++, PythonRuby, and Perl. Awesome is the speed of Swift. It’s up to two times faster than Java und up to 3 times faster than C / C++ depending which function will be used. For this test I implemented the following simple function:

    long sum = 0;
    for (Integer n = max; n > 0;  n--) {
        double foo = n / 17;
        sum = sum + n ;

I published the test on gitHub. If you want to implement more complex / meaningful tests or found a bug please please contribute some code. ?


Language wiime Elapsed
Swift 232ms
Java 518ms
JavaScript 606ms
C 1016ms
Objective-C 1062ms
C++ 1065ms
Python 7796ms
Ruby 8666ms
Perl 19673ms