Add gcc O2 optio flag and static link
Signed-off-by: Adrien Kara <adrien@iglou.eu>
This commit is contained in:
parent
673a74f573
commit
0472567422
48
README.md
48
README.md
|
@ -31,17 +31,28 @@ For build Go binary, you have 3 famous compiler. **Official go** compiler, **GCC
|
|||
|
||||
### Results
|
||||
|
||||
*ST is for Statically linked*
|
||||
*O2 is for optimisation level*
|
||||
|
||||
Bench test are run with `perf stat` *Performance analysis tools for Linux* hi is built in to linux kernel tree, so this is probably a good tool to bench ...
|
||||
Build Bench are manualy runing, result can be found on `bench_build.txt`
|
||||
Bench is runing by `bench.sh` and result are redirected to `bench_run.txt`
|
||||
You can find all RAW result on [/doc/result](doc/result/)
|
||||
|
||||
#### Build time
|
||||
| Compiler | CMD | Time | Status |
|
||||
|-------------|------------------------------|-----------------------|:------:|
|
||||
| GCC-GO | gccgo main.go -o bench_gccgo | 0.170248385 sec | ✅ |
|
||||
| TinyGo | tinygo build -o bench_tinygo | 9986.216965017 sec | ❌ |
|
||||
| Official Go | go build -o bench_go -a | 1.568412597 sec | ✅ |
|
||||
#### Build time / size
|
||||
| Name | Size |
|
||||
|-------------------|---------|
|
||||
| bench_go | 2.1M |
|
||||
| bench_gccgo | 66K |
|
||||
| bench_gccgo_STO2 | 6.8M |
|
||||
| bench_tinygo | 361K |
|
||||
|
||||
| Compiler | CMD | Time | Status |
|
||||
|-------------|------------------------------------------|-----------------------|:------:|
|
||||
| GCC-GO | gccgo main.go -o bench_gccgo | 0.170248385 sec | ✅ |
|
||||
| GCC-GO STO2 | gccgo -static -O2 main.go -o bench_gccgo | 1.034481239 sec | ✅ |
|
||||
| TinyGo | tinygo build -o bench_tinygo | 101.191178031 sec | ✅ |
|
||||
| Official Go | go build -o bench_go -a | 1.568412597 sec | ✅ |
|
||||
|
||||
#### Local run time
|
||||
For this part, whe see 'internal bench' for checking 4 hard cases, all case are tested multiple times.
|
||||
|
@ -65,17 +76,19 @@ func (i *intime) Stop() {
|
|||
```
|
||||
##### [Math] Prime number search
|
||||
|
||||
| Compiler | Time | Status |
|
||||
|-------------|---------------|:------:|
|
||||
| GCC-GO | 632.843018 ms | ❌ |
|
||||
| TinyGo | 399.317119 ms | ✅ |
|
||||
| Official Go | 509.82006 ms | ❌ |
|
||||
| Compiler | Time | Status |
|
||||
|-------------|------------------|:------:|
|
||||
| GCC-GO | 632.843018 ms | ✅ |
|
||||
| GCC-GO STO2 | 1.006531426 sec | ❌ |
|
||||
| TinyGo | 399.317119 ms | ✅ |
|
||||
| Official Go | 509.82006 ms | ✅ |
|
||||
|
||||
##### [Map] A very big map
|
||||
|
||||
| Compiler | Time | Status |
|
||||
|-------------|-------------------------|:------:|
|
||||
| GCC-GO | 406.668759 ms | ✅ |
|
||||
| GCC-GO STO2 | 444.171902 ms | ✅ |
|
||||
| TinyGo | **2h 42m 55.416901711 sec** | ❌ |
|
||||
| Official Go | 303.527414 ms | ✅ |
|
||||
|
||||
|
@ -84,21 +97,24 @@ func (i *intime) Stop() {
|
|||
| Compiler | Time | Status |
|
||||
|-------------|---------------------|:------:|
|
||||
| GCC-GO | 2.944123142 sec | ✅ |
|
||||
| GCC-GO STO2 | 7.969823537 sec | ✅ |
|
||||
| TinyGo | **3m 29.684675044 sec** | ❌ |
|
||||
| Official Go | 4.221176024 sec | ✅ |
|
||||
|
||||
##### [Loop] Loop managing
|
||||
|
||||
| Compiler | Time | Status |
|
||||
|-------------|-----------------|:------:|
|
||||
| GCC-GO | 9.281379494 sec | ❌ |
|
||||
| TinyGo | 457.010533 ms | ✅ |
|
||||
| Official Go | 3.519736744 sec | ❌ |
|
||||
| Compiler | Time | Status |
|
||||
|-------------|------------------|:------:|
|
||||
| GCC-GO | 9.281379494 sec | ❌ |
|
||||
| GCC-GO STO2 | 245 ns | ✅ |
|
||||
| TinyGo | 457.010533 ms | ✅ |
|
||||
| Official Go | 3.519736744 sec | ❌ |
|
||||
|
||||
#### Total execution time
|
||||
|
||||
| Compiler | Time | Status |
|
||||
|-------------|--------------------|:------:|
|
||||
| GCC-GO | 13.320942949 sec | ✅ |
|
||||
| GCC-GO STO2 | 9.436250825 sec | ✅ |
|
||||
| ~~TinyGo~~ | 9986.216965017 ms | ❌ |
|
||||
| **Official Go** | 8.562514977 sec | ✅ |
|
22
bench.sh
22
bench.sh
|
@ -1,12 +1,16 @@
|
|||
#!/bin/bash
|
||||
echo "=============== OFFICIAL GO ===============" > bench_run.txt
|
||||
perf stat ./bin/bench_go 1>>bench_run.txt 2>>bench_run.txt
|
||||
echo "" >> bench_run.txt
|
||||
echo "=============== OFFICIAL GO ===============" > doc/result/bench_run.txt
|
||||
perf stat ./bin/bench_go 1>>doc/result/bench_run.txt 2>>doc/result/bench_run.txt
|
||||
echo "" >> doc/result/bench_run.txt
|
||||
|
||||
echo "=============== GCC GO ===============" >> bench_run.txt
|
||||
perf stat ./bin/bench_gccgo 1>>bench_run.txt 2>>bench_run.txt
|
||||
echo "" >> bench_run.txt
|
||||
echo "=============== GCC GO ===============" >> doc/result/bench_run.txt
|
||||
perf stat ./bin/bench_gccgo 1>>doc/result/bench_run.txt 2>>doc/result/bench_run.txt
|
||||
echo "" >> doc/result/bench_run.txt
|
||||
|
||||
echo "=============== TINY GO ===============" >> bench_run.txt
|
||||
perf stat ./bin/bench_tinygo 1>>bench_run.txt 2>>bench_run.txt
|
||||
echo "" >> bench_run.txt
|
||||
echo "=============== GCC GO STO2 ===============" >> doc/result/bench_run.txt
|
||||
perf stat ./bin/bench_gccgo_STO2 1>>doc/result/bench_run.txt 2>>doc/result/bench_run.txt
|
||||
echo "" >> doc/result/bench_run.txt
|
||||
|
||||
echo "=============== TINY GO ===============" >> doc/result/bench_run.txt
|
||||
perf stat ./bin/bench_tinygo 1>>doc/result/bench_run.txt 2>>doc/result/bench_run.txt
|
||||
echo "" >> doc/result/bench_run.txt
|
||||
|
|
Binary file not shown.
|
@ -70,3 +70,24 @@ Total loop: 7445335968 IN 457.010533ms
|
|||
|
||||
|
||||
|
||||
=============== GCC GO STO2 ===============
|
||||
Nb prime found: 78498 IN 1.006531426s
|
||||
Map final len: 2000000 IN 444.171902ms
|
||||
Str final len: 516605 IN 7.969823537s
|
||||
Total loop: 7445335968 IN 245ns
|
||||
|
||||
Performance counter stats for './bin/bench_gccgo_STO2':
|
||||
|
||||
16,363.24 msec task-clock:u # 1.734 CPUs utilized
|
||||
0 context-switches:u # 0.000 K/sec
|
||||
0 cpu-migrations:u # 0.000 K/sec
|
||||
161,118 page-faults:u # 0.010 M/sec
|
||||
34,245,464,467 cycles:u # 2.093 GHz
|
||||
26,148,033,941 instructions:u # 0.76 insn per cycle
|
||||
5,767,468,805 branches:u # 352.465 M/sec
|
||||
75,944,783 branch-misses:u # 1.32% of all branches
|
||||
|
||||
9.436250825 seconds time elapsed
|
||||
|
||||
14.470940000 seconds user
|
||||
2.461421000 seconds sys
|
||||
|
|
Loading…
Reference in New Issue