The result first: 3.9s!
11 threads (the number of cores is 10, although 2 of them are not “performance cores”):
hyperfine -w 1 -r 5 './exe-exe > solution.txt'
Benchmark 1: ./exe-exe > solution.txt
Time (mean ± σ): 3.934 s ± 0.007 s [User: 36.062 s, System: 1.502 s]
Range (min … max): 3.925 s … 3.943 s 5 runs
On my computer, -fllvm
is still not faster - but for your version at least not slower - than not using it.
Without LLVM:
hyperfine -w 1 -r 5 './exe-exe > solution.txt'
Benchmark 1: ./exe-exe > solution.txt
Time (mean ± σ): 4.344 s ± 0.009 s [User: 32.554 s, System: 1.222 s]
Range (min … max): 4.333 s … 4.355 s 5 runs
With LLVM (about the same).
hyperfine -w 1 -r 5 './exe-exe > solution.txt'
Benchmark 1: ./exe-exe > solution.txt
Time (mean ± σ): 4.346 s ± 0.005 s [User: 32.559 s, System: 1.227 s]
Range (min … max): 4.340 s … 4.353 s 5 runs
But now to the number of threads:
11 threads:
hyperfine -w 1 -r 5 './exe-exe > solution.txt'
Benchmark 1: ./exe-exe > solution.txt
Time (mean ± σ): 3.934 s ± 0.007 s [User: 36.062 s, System: 1.502 s]
Range (min … max): 3.925 s … 3.943 s 5 runs
12 threads:
hyperfine -w 1 -r 5 './exe-exe > solution.txt'
Benchmark 1: ./exe-exe > solution.txt
Time (mean ± σ): 3.951 s ± 0.015 s [User: 36.132 s, System: 1.523 s]
Range (min … max): 3.936 s … 3.970 s 5 runs
10 threads (the number of cores, although 2 of them are not “performance cores”):
Benchmark 1: ./exe-exe > solution.txt
Time (mean ± σ): 3.968 s ± 0.013 s [User: 35.878 s, System: 1.449 s]
Range (min … max): 3.954 s … 3.982 s 5 runs
14 threads:
Benchmark 1: ./exe-exe > solution.txt
Time (mean ± σ): 3.991 s ± 0.012 s [User: 36.293 s, System: 1.555 s]
Range (min … max): 3.979 s … 4.004 s 5 runs
16 threads:
Benchmark 1: ./exe-exe > solution.txt
Time (mean ± σ): 4.029 s ± 0.012 s [User: 36.438 s, System: 1.589 s]
Range (min … max): 4.020 s … 4.051 s 5 runs
20 threads:
Benchmark 1: ./exe-exe > solution.txt
Time (mean ± σ): 4.100 s ± 0.037 s [User: 36.761 s, System: 1.631 s]
Range (min … max): 4.054 s … 4.142 s 5 runs
8 threads:
hyperfine -w 1 -r 5 './exe-exe > solution.txt'
Benchmark 1: ./exe-exe > solution.txt
Time (mean ± σ): 4.344 s ± 0.009 s [User: 32.554 s, System: 1.222 s]
Range (min … max): 4.333 s … 4.355 s 5 runs
200 threads:
Benchmark 1: ./exe-exe > solution.txt
Time (mean ± σ): 6.006 s ± 0.109 s [User: 41.527 s, System: 3.630 s]
Range (min … max): 5.921 s … 6.156 s 5 runs