ベンチマークをローカルで実行する
SunSpider、Kraken、Octane の「従来の」ベンチマークを実行するためのシンプルなワークフローがあります。さまざまなバイナリとフラグの組み合わせで実行できます。結果は複数のランで平均化されます。
CPU #
GN によるビルドの説明に従って d8
シェルを構築します。
ベンチマークを実行する前に、CPU の周波数スケーリングガバナーがパフォーマンスに設定されていることを確認します。
sudo tools/cpu.sh fast
cpu.sh
コマンドで認識されるコマンドを次に示します。
fast
、パフォーマンス(fast
のエイリアス)slow
、省電力(slow
のエイリアス)default
、オンデマンド(default
のエイリアス)dualcore
(2 つのコアを除くすべてを無効にする)、デュアル(dualcore
のエイリアス)allcores
(使用可能なコアをすべて再び有効にする)、すべて(allcores
のエイリアス)
CSuite #
CSuite
は簡単なベンチマークランナーです
test/benchmarks/csuite/csuite.py
(sunspider | kraken | octane)
(baseline | compare)
<path to d8 binary>
[-x "<optional extra d8 command-line flags>"]
まず、「ベースライン」モードで実行してベースラインを作成し、次に「比較」モードで実行して結果を取得します。CSuite
はデフォルトで Octane では 10 回、SunSpider では 100 回、Kraken では 80 回実行しますが、-r
オプションを使用してより迅速な結果を得るようにこれらの上書きできます。
CSuite
は、実行元ディレクトリに 2 つのサブディレクトリを作成します
./_benchmark_runner_data
— これは N 実行のキャッシュ出力です。./_results
— ここにマスターファイルに結果が書き込まれます。これらの
ファイルを異なる名前で保存できます。これらは比較モードに表示されます。
比較モードでは、当然ながら別のバイナリ、または少なくとも別のフラグを使用することになります。
使用例 #
2 つのバージョンの d8
を構築して、SunSpider に何が起こるかを確認するとします。まず、ベースラインを作成します
$ test/benchmarks/csuite/csuite.py sunspider baseline out.gn/master/d8
Wrote ./_results/master.
Run sunspider again with compare mode to see results.
推奨されているように、再度実行しますが、今度は「比較」モードで別のバイナリを使用します
$ test/benchmarks/csuite/csuite.py sunspider compare out.gn/x64.release/d8
benchmark: score | master | % |
===================================================+==========+========+
3d-cube-sunspider: 13.9 S 13.4 S -3.6 |
3d-morph-sunspider: 8.6 S 8.4 S -2.3 |
3d-raytrace-sunspider: 15.1 S 14.9 S -1.3 |
access-binary-trees-sunspider: 3.7 S 3.9 S 5.4 |
access-fannkuch-sunspider: 11.9 S 11.8 S -0.8 |
access-nbody-sunspider: 4.6 S 4.8 S 4.3 |
access-nsieve-sunspider: 8.4 S 8.1 S -3.6 |
bitops-3bit-bits-in-byte-sunspider: 2.0 | 2.0 | |
bitops-bits-in-byte-sunspider: 3.7 S 3.9 S 5.4 |
bitops-bitwise-and-sunspider: 2.7 S 2.9 S 7.4 |
bitops-nsieve-bits-sunspider: 5.3 S 5.6 S 5.7 |
controlflow-recursive-sunspider: 3.8 S 3.6 S -5.3 |
crypto-aes-sunspider: 10.9 S 9.8 S -10.1 |
crypto-md5-sunspider: 7.0 | 7.4 S 5.7 |
crypto-sha1-sunspider: 9.2 S 9.0 S -2.2 |
date-format-tofte-sunspider: 9.8 S 9.9 S 1.0 |
date-format-xparb-sunspider: 10.3 S 10.3 S |
math-cordic-sunspider: 6.1 S 6.2 S 1.6 |
math-partial-sums-sunspider: 20.2 S 20.1 S -0.5 |
math-spectral-norm-sunspider: 3.2 S 3.0 S -6.2 |
regexp-dna-sunspider: 7.6 S 7.8 S 2.6 |
string-base64-sunspider: 14.2 S 14.0 | -1.4 |
string-fasta-sunspider: 12.8 S 12.6 S -1.6 |
string-tagcloud-sunspider: 18.2 S 18.2 S |
string-unpack-code-sunspider: 20.0 | 20.1 S 0.5 |
string-validate-input-sunspider: 9.4 S 9.4 S |
SunSpider: 242.6 S 241.1 S -0.6 |
---------------------------------------------------+----------+--------+
前の実行の出力が、現在のディレクトリ内に作成されたサブディレクトリ(_benchmark_runner_data
)にキャッシュされます。集計結果は、ディレクトリ _results
にもキャッシュされます。比較ステップを実行した後は、これらのディレクトリを削除できます。
別の状況は、同じバイナリを使用する場合ですが、異なるフラグの結果を確認する場合です。少し愉快ではないかもしれませんが、最適化コンパイラなしで Octane がどのように動作するかを確認したいと思います。まず、ベースライン
$ test/benchmarks/csuite/csuite.py -r 1 octane baseline out.gn/x64.release/d8
Normally, octane requires 10 runs to get stable results.
Wrote /usr/local/google/home/mvstanton/src/v8/_results/master.
Run octane again with compare mode to see results.
多くのパフォーマンス最適化を確実に実行するには通常 1 回の実行では不十分ですが、私たちの「変更」では 1 回の実行で再現可能な影響があるはずです。次に比較してみましょう。--noopt
フラグを渡して TurboFan をオフにします
$ test/benchmarks/csuite/csuite.py -r 1 octane compare out.gn/x64.release/d8 \
-x "--noopt"
Normally, octane requires 10 runs to get stable results.
benchmark: score | master | % |
===================================================+==========+========+
Richards: 973.0 | 26770.0 | -96.4 |
DeltaBlue: 1070.0 | 57245.0 | -98.1 |
Crypto: 923.0 | 32550.0 | -97.2 |
RayTrace: 2896.0 | 75035.0 | -96.1 |
EarleyBoyer: 4363.0 | 42779.0 | -89.8 |
RegExp: 2881.0 | 6611.0 | -56.4 |
Splay: 4241.0 | 19489.0 | -78.2 |
SplayLatency: 14094.0 | 57192.0 | -75.4 |
NavierStokes: 1308.0 | 39208.0 | -96.7 |
PdfJS: 6385.0 | 26645.0 | -76.0 |
Mandreel: 709.0 | 33166.0 | -97.9 |
MandreelLatency: 5407.0 | 97749.0 | -94.5 |
Gameboy: 5440.0 | 54336.0 | -90.0 |
CodeLoad: 25631.0 | 25282.0 | 1.4 |
Box2D: 3288.0 | 67572.0 | -95.1 |
zlib: 59154.0 | 58775.0 | 0.6 |
Typescript: 12700.0 | 23310.0 | -45.5 |
Octane: 4070.0 | 37234.0 | -89.1 |
---------------------------------------------------+----------+--------+
CodeLoad
と zlib
が比較的損傷を受けなかったのは素晴らしいことです。
仕組み #
CSuite
は同じディレクトリの 2 つのスクリプト、benchmark.py
と compare-baseline.py
に基づいています。これらのスクリプトには、他にも多くのオプションがあります。たとえば、複数のベースラインを記録し、3、4、または 5 ウェイの比較を行うことができます。CSuite
は迅速な使用のために最適化されており、柔軟性を犠牲にしています。