歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux編程 >> Linux編程

Go1.1性能測試報告(和C差距在10%以內)

目錄:

  • 測試環境
  • 測試結果
  • 測試結果說明
  • 關於 BenchmarksGame 的測試差異
  • 官方的測試結論

最近Go1.1正式發布, 根據官方的說法, Go1.1性能比Go1.0提升基本有30%-40%, 有時更多(當然也有不明顯的情況).

Go1.1的詳細介紹: Go1.1新特性介紹(語言和庫更完善/性能提高約30%)  http://www.linuxidc.com/Linux/2013-05/84325.htm .

這裡是針對Go1.1和C語言的性能測試: 測試的重點是語言的性能, 當然也會受到標准庫性能的影響.

測試環境

  • 測試程序: $GOROOT/test/bench/shootout/timing.sh
  • 硬件配置: i7 8核, 16GB內存
  • 操作系統: CentOS6.3 x86_64

gccgc版本:

gcc -v
gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)

go version
go version go1.1 linux/amd64

 

測試結果

$GOROOT/test/bench/shootout/timing.sh
fasta -n 25000000
    gcc -m64 -O2 fasta.c              0.86u 0.00s 0.87r
    gc fasta                          0.85u 0.00s 0.86r
    gc_B fasta                        0.83u 0.00s 0.83r

reverse-complement < output-of-fasta-25000000
    gcc -m64 -O2 reverse-complement.c 0.45u 0.05s 0.50r
    gc reverse-complement             0.60u 0.05s 0.65r
    gc_B reverse-complement           0.55u 0.04s 0.59r

nbody -n 50000000
    gcc -m64 -O2 nbody.c -lm          5.51u 0.00s 5.52r
    gc nbody                          7.16u 0.00s 7.18r
    gc_B nbody                        7.12u 0.00s 7.14r

binary-tree 15 # too slow to use 20
    gcc -m64 -O2 binary-tree.c -lm    0.31u 0.00s 0.31r
    gc binary-tree                    1.08u 0.00s 1.07r
    gc binary-tree-freelist           0.15u 0.00s 0.15r

fannkuch 12
    gcc -m64 -O2 fannkuch.c           26.45u 0.00s 26.54r
    gc fannkuch                       35.99u 0.00s 36.08r
    gc fannkuch-parallel              73.40u 0.00s 18.58r
    gc_B fannkuch                     25.18u 0.00s 25.25r

regex-dna 100000
    gcc -m64 -O2 regex-dna.c -lpcre   0.25u 0.00s 0.26r
    gc regex-dna                      1.65u 0.00s 1.66r
    gc regex-dna-parallel             1.72u 0.01s 0.67r
    gc_B regex-dna                    1.64u 0.00s 1.65r

spectral-norm 5500
    gcc -m64 -O2 spectral-norm.c -lm  9.63u 0.00s 9.66r
    gc spectral-norm                  9.63u 0.00s 9.66r
    gc_B spectral-norm                9.63u 0.00s 9.66r

k-nucleotide 1000000
    gcc -O2 k-nucleotide.c -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -lglib-2.0  2.62u 0.00s 2.63r
    gc k-nucleotide                   2.69u 0.01s 2.71r
    gc k-nucleotide-parallel          3.02u 0.00s 0.97r
    gc_B k-nucleotide                 2.66u 0.01s 2.68r

mandelbrot 16000
    gcc -m64 -O2 mandelbrot.c        20.95u 0.00s 21.01r
    gc mandelbrot                    23.73u 0.00s 23.79r
    gc_B mandelbrot                  23.72u 0.00s 23.79r

meteor 2098
    gcc -m64 -O2 meteor-contest.c     0.05u 0.00s 0.05r
    gc meteor-contest                 0.06u 0.00s 0.07r
    gc_B meteor-contest               0.06u 0.00s 0.06r

pidigits 10000
    gcc -m64 -O2 pidigits.c -lgmp     0.77u 0.00s 0.77r
    gc pidigits                       1.45u 0.01s 1.44r
    gc_B pidigits                     1.45u 0.01s 1.43r

threadring 50000000
    gcc -m64 -O2 threadring.c -lpthread     12.05u 261.20s 216.36r
    gc threadring                           6.61u 0.00s 6.63r

chameneos 6000000
    gcc -m64 -O2 chameneosredux.c -lpthread 4.04u 21.08s 4.20r
    gc chameneosredux                       4.97u 0.00s 4.99r
Copyright © Linux教程網 All Rights Reserved