haxe icon indicating copy to clipboard operation
haxe copied to clipboard

[cpp] [hl] Slow performance of trace command

Open sebthom opened this issue 6 years ago • 3 comments

The following code runs significantly slower on HL and CPP compared to other targets:

class TraceTest {

    public static function main() {
        var start = haxe.Timer.stamp();
        for (i in 1...2000)
            trace(i);
        var duration =  Math.round((haxe.Timer.stamp() - start)*100) / 100;
        trace('Duration: $duration seconds.');
    }
}

I tested Haxe 4RC5 on Windows 10, these are my results:

Target Duration
CPP 18.73 secs
HL 1.10 10.5 secs
PHP5 0.88 secs
Java8 0.85 secs
Node.js 10.16 0.65 secs
C# 0.51secs
PHP7 0.51 secs
Neko2.2 0.49 secs
Python3.7 0.45 secs

sebthom avatar Sep 20 '19 13:09 sebthom

Might have something to do with flushing stdout maybe?

Aurel300 avatar Sep 20 '19 14:09 Aurel300

Yes, HL will flush stdout on every print, maybe we could only do that when debugger is enabled

ncannasse avatar Sep 21 '19 22:09 ncannasse

Yes, HL will flush stdout on every print, maybe we could only do that when debugger is enabled

@ncannasse The issue is still present in Haxe 4.2.5 and HL 1.1.2. Do you think you could implement your suggestion?

sebthom avatar Jun 28 '22 19:06 sebthom