I've recently written some evolutionary algorithm and noticed very strange behaviour of those compilers. The exact same code compiled by Cygwin gives much better results in shorter time and it's totally repeatable. The only idea I had which may explain the difference is randomness (which I utilize in mutations as well as in generating population). Is it possible that compiler implementation affect library functions as random so hard?
Output of running the algorithm 5 times, the aim was to minimize distance and 291 was the minimal one.
Cygwin :
1210092100 ns, distance: 291
1317734900 ns, distance: 291
1030229700 ns, distance: 291
1322172900 ns, distance: 291
1251860000 ns, distance: 291
MinGW:
4207164000 ns, distance: 526
4011749000 ns, distance: 659
3927796000 ns, distance: 574
3995656000 ns, distance: 704
3953421000 ns, distance: 649
Aucun commentaire:
Enregistrer un commentaire