Skip to main content

Pyston's performance almost as unimpressive as Python's


I just read about pyston, so after reading how to install it, I gave it a shot. Old script, new results.

Script execution in seconds (lower is better)

Seems like both python3 and pyston have some catching up to do when it comes to performance (especially when using dictionaries). Not even close to C# and pypy is still the best. (C# was not retested, but pypy and python3 was).

And to make it complete, why not include C++ STL?


Performance comparison:
Script execution in seconds (lower is better)

Not really sure how pypy outperforms C++ STL, but quite impressive to say the least. I wasn't really expecting it.

Script for C++:

#include <iostream>
#include <iterator>
#include <map>
#include <time.h>
#include <cstdlib>
#include <stdio.h>
#include <sys/time.h>
#include <math.h>

using namespace std;

int main () {
    map<string, bool> dic;

    for(int i=0;i<10000001;i++)
            char buffer[26];
            struct timeval tv;
            struct tm* tm_info;
            gettimeofday(&tv, NULL);
            int millisec = lrint(tv.tv_usec/1000.0);
            if (millisec>=1000) {
                millisec -=1000;
            tm_info = localtime(&tv.tv_sec);
            strftime(buffer, 26, "%Y:%m:%d %H:%M:%S", tm_info);
            printf("%s.%03d\n", buffer, millisec);

        string s = "";
        char letter[] = "qwertyuiopasdfghjklz\0";
        for(int j=0;j<50;j++)
            s += letter[rand()%20];
            dic[s] = true;
    return 0;