http://d.puremagic.com/issues/show_bug.cgi?id=5650



--- Comment #3 from bearophile_h...@eml.cc 2011-02-24 14:27:34 PST ---
The D version runs in about 20.6 seconds, the Java -server version in about
0.49 seconds, and this C++ (GCC 4.5.1 -O3) version in about 0.3 seconds (this
is not a fully apples-to-apples comparison because this doesn't use a GC, but
it's good as reference point):


#include <stdio.h>
#include <set>

using namespace std;

int main() {
    const int range = 100;
    const int n = 1000000;

    set<int> t;
    for (int i = 0; i < n; i++) {
        if (i > range)
            t.erase(t.begin());
        t.insert(i);
    }

    printf("%d\n", t.size());
    //for (set<int>::iterator it=t.begin(); it!=t.end(); ++it)
    //    printf("%d ", *it);
    //printf("\n");

    return 0;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to