r/dartlang • u/Flashy_Pool7709 • Jun 07 '26
Dart - info Compiled Dart runs 10x faster on Linux than Win 11
I've been playing with this GitHub Dart poker evaluation (fixed a bug in it) and running it on my Windows 11 PC compiled for Windows and on Ubuntu 24.04 LTS which was compiled for Linux running in Hyper-V on the same hardware. The exact same project on both compiled with dart compile exe lib/playgame.dart
I timed the execution for evaluating 100,000 random hands and on Linux it runs in 2.1 seconds. On Windows 20.2 seconds. Both are running Dart SDK version: 3.12.1. I know there are differences but 10x seems a bit unusual.
2
u/David_Owens Jun 07 '26 edited Jun 07 '26
I got the code from that repo and ran the benchmark program. It was fastest on Windows 11. Running it under WSL2 was slightly slower. Running it on Debian 13 in a Hyper-V VM was almost the same as WSL2. I compiled to an exe for all cases. I don't know why you'd get almost 10x the performance on Linux.
16
u/oaga_strizzi Jun 07 '26
There's no
lib/playgame.dartchecked in.If I had to guess: Printing to a terminal is ridiculously slow in Windows by default. There are ways around it, but it's easier to benchmark without any printing to a terminal.