[UPDATED, SEE RESULTS...] Two Questions: I timed the main( ) only, i.e. just the main execution {block} in all cases:
1. Is it typical that kotlinc .jar is ~10% faster than the kotlinc-native .exe native?
2. is there any way to optimize the kotlinc-native build akin to a --release mode flag/switch or does it default to fastest possible build?
Background: Calculate the first 30 anti-primes and time various target's runtimes. Built/ran in W11 Pro 64-bit script (all from Rosetta Code)
Kotlin: v1.9.22-release-704 (JRE 21.0.1+12-LTS)
C++: C++23 g++ via MinGW-W64 x86_64-ucrt-mcf-seh via winlibs latest v13.2.0 build
Results:
• antiprimes.jar (kotlinc w/runtime): 9,205 ms (ran with java -jar ...)
• antiprimes.jar (kotlinc no runtime): 9,098 ms (ran with kotlinc -classpath...)
• antiprimes.exe (kotlinc-native): 10,942 ms [UPDATED: now 6,800 ms with -opt flag, thanks Shawn !!!]
• antiprimes.exe (C++23 native): 6,118 ms (just as benchmark, same algorithm, used -O3 max speed optimization flag)
BTW, Kotlin (all cases) did very good, extremely respectable speed! I am impressed and happy.
Thank you for reading and any suggestions. (edited)