Summary: A RedBlackTree performance problem
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: performance
          Severity: normal
          Priority: P2
         Component: Phobos

--- Comment #0 from 2011-02-24 13:42:25 PST ---
On my PC the D version is about 41 times slower than the Java (-server)
version, despite the Java version is using boxed Integers. (The Java version
also seem to use a few megabytes less memory, but this is not so significant).

(Because of this performance problem I can't use RedBlackTree in a program I am
writing, and I need to use a different solution.)


// D2 code
import std.stdio, std.container, std.range;

void main() {
    enum int range = 100;
    enum int n = 1_000_000;

    auto t = RedBlackTree!int(0);

    for (int i = 0; i < n; i++) {
        if (i > range)



// Java code
import java.util.TreeSet;

class Test1 {
    public static void main(String[] args) {
        final int range = 100;
        final int n = 1000000;

        TreeSet<Integer> t = new TreeSet<Integer>();

        for (int i = 0; i < n; i++) {
            if (i > range)


Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to