自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

Go1.1性能測(cè)試報(bào)告(和C差距在10%以內(nèi))

開(kāi)發(fā) 測(cè)試
最近Go1.1正式發(fā)布, 根據(jù)官方的說(shuō)法, Go1.1性能比Go1.0提升基本有30%-40%, 有時(shí)更多(當(dāng)然也有不明顯的情況).

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

Go1.1的詳細(xì)介紹: Go1.1新特性介紹(語(yǔ)言和庫(kù)更完善/性能提高約30%).

這里是針對(duì)Go1.1和C語(yǔ)言的性能測(cè)試: 測(cè)試的重點(diǎn)是語(yǔ)言的性能, 當(dāng)然也會(huì)受到標(biāo)準(zhǔn)庫(kù)性能的影響.

測(cè)試環(huán)境

補(bǔ)充: i7-3770是4核心8線程.

gccgc版本:

 

  1. gcc -v  
  2. gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)  
  3.  
  4. go version  
  5. go version go1.1 linux/amd64  

 

測(cè)試結(jié)果

 

  1. $GOROOT/test/bench/shootout/timing.sh  
  2. fasta -n 25000000 
  3.     gcc -m64 -O2 fasta.c              0.86u 0.00s 0.87r  
  4.     gc fasta                          0.85u 0.00s 0.86r  
  5.     gc_B fasta                        0.83u 0.00s 0.83r  
  6.  
  7. reverse-complement < output-of-fasta-25000000 
  8.     gcc -m64 -O2 reverse-complement.c 0.45u 0.05s 0.50r  
  9.     gc reverse-complement             0.60u 0.05s 0.65r  
  10.     gc_B reverse-complement           0.55u 0.04s 0.59r  
  11.  
  12. nbody -n 50000000 
  13.     gcc -m64 -O2 nbody.c -lm          5.51u 0.00s 5.52r  
  14.     gc nbody                          7.16u 0.00s 7.18r  
  15.     gc_B nbody                        7.12u 0.00s 7.14r  
  16.  
  17. binary-tree 15 # too slow to use 20 
  18.     gcc -m64 -O2 binary-tree.c -lm    0.31u 0.00s 0.31r  
  19.     gc binary-tree                    1.08u 0.00s 1.07r  
  20.     gc binary-tree-freelist           0.15u 0.00s 0.15r  
  21.  
  22. fannkuch 12 
  23.     gcc -m64 -O2 fannkuch.c           26.45u 0.00s 26.54r  
  24.     gc fannkuch                       35.99u 0.00s 36.08r  
  25.     gc fannkuch-parallel              73.40u 0.00s 18.58r  
  26.     gc_B fannkuch                     25.18u 0.00s 25.25r  
  27.  
  28. regex-dna 100000 
  29.     gcc -m64 -O2 regex-dna.c -lpcre   0.25u 0.00s 0.26r  
  30.     gc regex-dna                      1.65u 0.00s 1.66r  
  31.     gc regex-dna-parallel             1.72u 0.01s 0.67r  
  32.     gc_B regex-dna                    1.64u 0.00s 1.65r  
  33.  
  34. spectral-norm 5500 
  35.     gcc -m64 -O2 spectral-norm.c -lm  9.63u 0.00s 9.66r  
  36.     gc spectral-norm                  9.63u 0.00s 9.66r  
  37.     gc_B spectral-norm                9.63u 0.00s 9.66r  
  38.  
  39. k-nucleotide 1000000 
  40.     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  
  41.     gc k-nucleotide                   2.69u 0.01s 2.71r  
  42.     gc k-nucleotide-parallel          3.02u 0.00s 0.97r  
  43.     gc_B k-nucleotide                 2.66u 0.01s 2.68r  
  44.  
  45. mandelbrot 16000 
  46.     gcc -m64 -O2 mandelbrot.c        20.95u 0.00s 21.01r  
  47.     gc mandelbrot                    23.73u 0.00s 23.79r  
  48.     gc_B mandelbrot                  23.72u 0.00s 23.79r  
  49.  
  50. meteor 2098 
  51.     gcc -m64 -O2 meteor-contest.c     0.05u 0.00s 0.05r  
  52.     gc meteor-contest                 0.06u 0.00s 0.07r  
  53.     gc_B meteor-contest               0.06u 0.00s 0.06r  
  54.  
  55. pidigits 10000 
  56.     gcc -m64 -O2 pidigits.c -lgmp     0.77u 0.00s 0.77r  
  57.     gc pidigits                       1.45u 0.01s 1.44r  
  58.     gc_B pidigits                     1.45u 0.01s 1.43r  
  59.  
  60. threadring 50000000 
  61.     gcc -m64 -O2 threadring.c -lpthread     12.05u 261.20s 216.36r  
  62.     gc threadring                           6.61u 0.00s 6.63r  
  63.  
  64. chameneos 6000000 
  65.     gcc -m64 -O2 chameneosredux.c -lpthread 4.04u 21.08s 4.20r  
  66.     gc chameneosredux                       4.97u 0.00s 4.99r  

 

測(cè)試結(jié)果說(shuō)明

其中gc_B是開(kāi)了-B選項(xiàng), 選項(xiàng)的說(shuō)明如下:

 

  1. go tool 6g -h  
  2. usage: 6g [options] file.go...  
  3.   -+    compiling runtime  
  4.   -%    debug non-static initializers  
  5.   -A    for bootstrapping, allow 'any' type  
  6.   -B    disable bounds checking  
  7. ...  

 

應(yīng)該就是禁用了Go的slice下標(biāo)越界檢測(cè)等特性.

測(cè)試的結(jié)果顯示Go的性能已經(jīng)和C語(yǔ)言已經(jīng)非常接近了, 有極個(gè)別的甚至比C還好(binary-tree).

根據(jù)$GOROOT/test/bench/shootout/timing.log的數(shù)據(jù), gccgo 的優(yōu)化應(yīng)該更好一點(diǎn).

不過(guò)gccgo的標(biāo)準(zhǔn)庫(kù)比gc性能可能要差一些(因此有些測(cè)試性能比gc差一些).

我電腦沒(méi)有安裝gccgo, 因此只有g(shù)cc/gc/gc_B三個(gè)測(cè)試結(jié)果.

關(guān)于 BenchmarksGame 的測(cè)試差異

http://benchmarksgame.alioth.debian.org/u64q/go.php

BenchmarksGame的測(cè)試結(jié)果中, 有幾個(gè)Go的性能很差:

 

  1. Benchmark      Time Memory   Code  
  2. fasta           3×    3×      ±  
  3. spectral-norm   4×    3×      ±  
  4. binary-trees   13×    4×      ±  
  5. regex-dna †    26×    ±      1/4 

 

其中 spectral-normbinary-trees 的 C 版本都開(kāi)了 #pragma omp 優(yōu)化(這已經(jīng)不是C語(yǔ)言級(jí)別的比較了).

而 Go 的 binary-trees 啟動(dòng)了很多 goroutine, Go并發(fā)的版本和C的非并發(fā)版本比較肯定也是不合理的.

其中regex的測(cè)試主要是Go的regex標(biāo)準(zhǔn)庫(kù)和C的高度優(yōu)化的pcre比較. 目前Go的regex庫(kù)還有待進(jìn)一步的優(yōu)化.

關(guān)于其他的各個(gè)程序, 實(shí)現(xiàn)和$GOROOT/test/bench/shootout都是有一定的差異的.

官方的測(cè)試結(jié)論

http://go.googlecode.com/hg/test/bench/shootout/timing.log:

 

  1. # Sep 262012 
  2. 64-bit ints, plus significantly better floating-point code.  
  3. # Interesting details:  
  4. #   Generally something in the 0-10% slower range, some (binary tree) more  
  5. #   Floating-point noticeably faster:  
  6. #       nbody -25%  
  7. #       mandelbrot -37% relative to Go 1.  
  8. #   Other:  
  9. #       regex-dna +47%  

 

Go已經(jīng)和C差距在10%以內(nèi), 有特殊場(chǎng)景性能甚至更好.

原文鏈接:http://my.oschina.net/chai2010/blog/130859

責(zé)任編輯:林師授 來(lái)源: chai2010的博客
相關(guān)推薦

2013-05-15 09:37:00

GoGo1.1性能測(cè)試

2025-04-14 00:00:00

2013-05-22 09:38:03

GoGo語(yǔ)言Go性能

2010-04-21 17:21:21

Ubuntu Live

2010-01-12 17:12:21

千兆骨干交換機(jī)

2010-07-02 14:21:02

Exchange 20

2012-02-27 16:04:28

戴爾

2021-05-07 14:45:07

SpeedtestStarlink網(wǎng)速測(cè)試

2010-04-27 13:25:05

H3C S12518交換機(jī)測(cè)試報(bào)告

2017-09-01 11:35:37

C++語(yǔ)言編譯器

2011-01-28 10:46:45

MeeGo Core 上網(wǎng)本版MeeGo

2013-04-01 10:22:21

GoGo 1.1

2009-10-09 16:10:56

服務(wù)器測(cè)試報(bào)告存儲(chǔ)型服務(wù)器

2010-01-13 15:39:55

以太網(wǎng)交換機(jī)

2017-12-27 16:17:48

中國(guó)電信

2010-01-13 14:19:05

千兆接入交換機(jī)

2009-02-17 20:25:54

湖北國(guó)稅虛擬化應(yīng)用測(cè)試報(bào)告

2016-05-17 14:15:57

2022-08-11 16:37:55

單元測(cè)試代碼

2016-09-21 10:18:26

阿里Dubbo性能測(cè)試
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)