Which programming languages perform faster in condingame?

Did anyone run comparative speed tests with multiple languages here? If yes, did any supported language demonstrated an unfair advantage compared to the others? Did some of the languages perform really bad?

Among the popular languages, C++ seems to be the fastest and the most efficient, whereas Python seems to be the slowest. Nonetheless, it depends on the type of algorithm used, which vary depending on the contest.
Someone may give a more detailled answer, but this is the short answer :slight_smile:

2 Likes

I don’t know if the brute-force solutions of the Teads and the Roller coaster in C++ pass the tests.
They do not pass in Python. :whistle:

You can use a stop watch for calculating the initialization time for example and within the game loop to calculate how long each game turn takes.

E.g.: (Dart):

void main() {
    var initStopWatch = new Stopwatch()..start();
    ....
    initStopWatch.stop();  
    stderr.writeln('Time for Init: ${initStopWatch.elapsedMilliseconds}ms');   
    
    var sw = new Stopwatch();   
    
    // game loop
    while (true) {
        sw.reset();
        sw.start();
        ...
        gc.turn++;
        
        sw.stop();
        stderr.writeln('Time for game turn ${gc.turn - 1}: ${sw.elapsedMilliseconds}ms');
    }
}

Well, might be useful for multiplayer games and should give you the idea :wink:

1 Like

Probably not. Those 2 challenges have a time limit depending on the language to keep a kind of balance. Only multiplayer games and turn-based solo puzzles have the same fixed time limit per turn.

1 Like

A small and a little old discussion (in french) on this topic: https://groups.google.com/forum/#!topic/codingame-tron-battle-fr/gxHOvRdFZEw. In any cases, the conclusion is always the same : there is no such thing as a language velocity, just a complex combination of platforms, compilers and optimizations and, above all, clever algorithms. That being said, Bash is slow :wink:

3 Likes

Note to self… another reason why learning Bash is something I should do to just be a total douche.