haxe
haxe copied to clipboard
[cpp] [hl] Slow performance of trace command
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 |
Might have something to do with flushing stdout maybe?
Yes, HL will flush stdout on every print, maybe we could only do that when debugger is enabled
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?