Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Compare Benchmarks and Compiler Optimization I...
Search
po3rin
May 27, 2019
Programming
4
770
Compare Benchmarks and Compiler Optimization In Go
Go(Un) Conference #6
po3rin
May 27, 2019
Tweet
Share
More Decks by po3rin
See All by po3rin
M3におけるCI/CDパイプラインを新鮮に保つ仕組み
po3rin
0
270
Go Templateを使った フロントエンド開発を採用した 経緯と所感
po3rin
0
280
検索基盤移行時の思考
po3rin
0
4.2k
Go1.19で採用された Pattern-defeating Quicksort の紹介
po3rin
7
5.5k
Elasticsearchを負荷から守るesguard
po3rin
0
230
Sudachi×Elasticsearchへの移行と医療検索システム精度改善
po3rin
1
820
eskeeperを使ったファイル定義によるindex管理
po3rin
2
450
M3 情報検索/推薦論文輪読会 ~SIGIR祭~ (SIGIR2021: Session 6D – IR Models)
po3rin
0
76
Handling Temporal Query for Health Search with ja-timex
po3rin
3
300
Other Decks in Programming
See All in Programming
距離関数を極める! / SESSIONS 2024
gam0022
0
280
Enabling DevOps and Team Topologies Through Architecture: Architecting for Fast Flow
cer
PRO
0
330
CSC509 Lecture 13
javiergs
PRO
0
110
Outline View in SwiftUI
1024jp
1
330
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
C++でシェーダを書く
fadis
6
4.1k
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
600
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
1k
Better Code Design in PHP
afilina
PRO
0
130
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
470
TypeScript Graph でコードレビューの心理的障壁を乗り越える
ysk8hori
2
1.1k
Featured
See All Featured
The Cult of Friendly URLs
andyhume
78
6k
Thoughts on Productivity
jonyablonski
67
4.3k
BBQ
matthewcrist
85
9.3k
Docker and Python
trallard
40
3.1k
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
A designer walks into a library…
pauljervisheath
204
24k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
For a Future-Friendly Web
brad_frost
175
9.4k
Code Review Best Practice
trishagee
64
17k
Visualization
eitanlees
145
15k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
The Invisible Side of Design
smashingmag
298
50k
Transcript
Compare Benchmarks and Compiler Optimization In Go Go Un Conference
May 27, 2019 @ po3rin
@po3rin Software Enginner @ Shiroyagi Corporation QBHF Golang / Python
/ Rust / Docker / AWS / Elasticsearch
QBHF Introduction \
QBHF 044ʹίϛοτΛࢼΈΔࡍʹɺʮͳͥ ͜ͷ࣮͕ྑ͍͔ʯΛূ໌͢Δҝʹ (Pʹ͓͚ΔϕϯνϚʔΫʹ͍ͭͯௐ ͨͷͰͦΕΛൃද͠·͢ɻ Benchmark of Go Ὂ
QBHF ɾϕϯνϚʔΫΛʮূ໌ʯʹ͑ΔΑ͏ʹͳΔ ɾϕϯνϚʔΫٻ͔ΒίϯύΠϥ࠷దԽΛআ͘ Ὂ the porpose of this talk
QBHF Review how to take a benchmark \
QBHF Review how to take a benchmark Ὂ ֤ϕϯνϚʔΫؔC/ճ෮ ͞Ε·͢ɻσϑΥϧτͰC/
͔Β࢝·Γ·͕͢ɺϕϯνϚʔ Ϋػೳ͕ඵҎʹྃͨ͠߹ C/͕૿Ճͯ͠ϕϯνϚʔΫ͕࠶ ࣮ߦ͞Ε·͢ɻ
QBHF Review how to take a benchmark Ὂ ݁ՌΛݟΔͱͱ͍͏TV⒏Y͕͍͍ͭͯ·͢ɻ͜Ε͜ͷςετΛ࣮ߦ͢ΔͨΊ ʹ༻͞Εͨ(0."9130$4ͷͰ͢ɻ͜ͷσϑΥϧτͰىಈ࣌ʹ(Pϓϩ
ηεʹݟ͑Δ$16ͷʹͳΓ·͢ɻ
QBHF -cpu Ὂ (0."9130$4DQVϑϥάͰมߋͰ͖·͢ɻνʔϜؒͰϕϯνϚʔΫΛ͍ճ ࣌͢$16ͷ͕ϕϯνϚʔΫʹӨڹΛ༩͑ͳ͍Α͏ʹҙ͕ඞཁͰ͢ɻ
QBHF -benchtime Ὂ ෮ճΛ૿͢ҝʹ CFODIUJNFϑϥάΛ༻ ͯ͠ϕϯνϚʔΫ࣌ؒΛ ૿͢͜ͱ͕Ͱ͖·͢ɻ (P͔ΒCFODIUJNF ϑϥά෮ճΛࢦఆ Ͱ͖·͢ɻ
QBHF Benchmark cost avoidance Ὂ C3FTFU5JNFS ͰηοτΞοϓͰ ൃੜ͢ΔίετΛճආͰ͖·͢ɻ ϧʔϓͷ෮͝ͱʹίετ͕ߴ͍ ηοτΞοϓ͕͋Δ߹ɺ
C4UPQ5JNFS ͓Αͼ C4UBSU5JNFS Λ༻͠·͢ɻ
QBHF Check allocations Ὂ ΞϩέʔγϣϯͷͱαΠζɺϕϯνϚʔΫͱڧ͘૬͍ؔͯ͠·͢ɻΞϩέʔ γϣϯͷΛϕϯνϚʔΫͰ֬ೝ͢Δ࣌CFODINFNΛ͍·͢ɻ
QBHF Benchmark stability \
QBHF Benchmark stability Ὂ ඦສ·ͨेԯճ΄Ͳ෮࣮ߦ͞ ΕΔϕϯνϚʔΫ͕OTdNTͷൣғ ͷͳΔ߹ɺϕϯνϚʔΫε έʔϦϯάɺϝϞϦہॴੑͳͲ༷ʑͳ ཁҼʹΑΓෆ҆ఆʹͳ͍ͬͯ·͢ɻ
QBHF Benchmark stability Ὂ ͜ͷΑ͏ͳ߹DPVOUϑ ϥάΛ༻ͯ͠ɺϕϯν ϚʔΫΛෳճ࣮ߦ͢Δ͜ ͱͰϕϯνϚʔΫͷࢄ ؚΊͯ֬ೝ͢Δͷ͕ಘࡦͰ ͢ɻ
QBHF Benchmark stability Ὂ ҰํͰϕϯνϚʔΫͷ҆ఆΛݟΔͷʹศརͳπʔϧ͕͋Γ· ͢ɻ3VTT$PYʹΑΔCFODITUBUͱ͍͏πʔϧΛհ͠·͢ɻ
QBHF Benchmark stability Ὂ CFODITUBUҰ࿈ͷϕϯνϚʔΫ ςετΛ࣮ߦͯ͠ɺͦΕΒ͕ͲΕ ΄Ͳ҆ఆ͍ͯ͠Δ͔Λڭ͑ͯ͘Ε ·͢ɻ
QBHF Comparing benchmarks \
QBHF Comparing benchmarks Ὂ ϕϯνϚʔΫؒͷύϑΥʔϚϯεͷࠩΛஅ͢Δͷ໘Ͱ͕͢ɺ CFODITUBU͜ͷղܾ͠·͢ɻ
QBHF ૣ'JC Λվྑ͍ͨ͠ͷͰ͕͢ɺίʔυΛվྑͨ͠ޙͰɺ ͏ҰվྑલͷϕϯνϚʔΫΛऔΓ͍͕ͨ࣌ग़͖ͯͨΒ Ͳ͏͠·͠ΐ͏͔ɻ࣮HPUFTUʹલճͷϕϯνϚʔΫ݁ ՌΛੜͨ͠όΠφϦΛอଘ͓ͯ͘͜͠ͱ͕Ͱ͖ΔػೳΛ ఏڙ͢ΔDϑϥοά͕ଘࡏ͠·͢ɻվྑલͷόΠφϦ໊ UFTU͔ΒHPMEFOʹมߋ͢Δͷ͕௨ྫͷΑ͏Ͱ͢ɻ -c Ὂ
QBHF ϕϯνϚʔΫΛൺֱ͢Δҝ ʹ࠶ؼݺͼग़͠Λ̍ͭݮΒ ͠·͢ɻ Reduce recursive calls Ὂ
QBHF 'JC Ͱ'JC ͱൺͯͷվྑ͕֬ೝͰ͖·͢ɻιʔείʔυͷมߋ ޙʹͲͷ͘Β͍ͷվળ͕͋ͬͨͷ͔Λূ໌͢Δͷʹ༗༻Ͱ͢ɻࢄ͕େ͖͍ϕϯ νϚʔΫΛൺֱ͢Δͱ͖ҙɻ Comparing benchmarks
Ὂ
QBHF Oɺ༗ޮͩͱݟͳ͞ΕͨσʔλͷݸΛද͠·͢ɻσʔλͷغ٫͕ˋΛ͑ Δͱൺֱ͢Δαϯϓϧ͕গͳ͗͢ΔՄೳੑ͕͋Γ·͢ɻ Q͕Λ͑Δ͜ͱϕϯνϚʔΫ͕౷ܭతʹ༗ҙͰͳ͍͜ͱΛҙຯ͠·͢ɻ Qʹ͍ͭͯԼه͕ৄ͍͠Ͱ͢ɻ ౷ܭֶతݕఆͷ1ɺ౷ܭֶతʹ༗ҙɺ༗ҙࠩɺ༗ҙਫ४ͱԿ͔ʁ IUUQUPVLFJMJOLCBTJDTUBUJTUJDTQWBMVF@BOE@TJHOJpDBODF Comparing benchmarks Ὂ
QBHF Watch out for compiler optimisations \
QBHF ਐͰදͨ͠ͱཱ͖͍ͬͯΔ ϏοτͷΛฦ͠·͢ɻ͜ͷؔ ͷϕϯνϚʔΫΛͱΓ·͠ΐ ͏ɻ compiler optimisations Ὂ
QBHF ͜ͷ݁Ռͷඵ֓ͶΫϩοΫपͰ͢ɻΑͬͯ͜ͷ͔ͳΓ͓͔͍͠Ͱ͢ɻ $16ΫϩοΫ৴߸ʹ߹Θͤͯಈ࡞͠·͢ QPQDOUϦʔϑؔ ଞͷؔݺͼग़͠Λ͠ͳ͍ ʹͳ͍ͬͯ·͢ɻɻίϯύΠϥ͜ ͷؔΛΠϯϥΠϯల։Ͱ͖·͢ɻͦͯ͠QPQDOUɺͲͷάϩʔόϧมͷঢ়ଶʹ Өڹ͠·ͤΜɻ͕ͨͬͯ͠ɺݺͼग़ࣗ͠ମ͕ഉআ͞Ε͍ͯ·͢ɻ compiler
optimisations Ὂ
QBHF ϕϯνϚʔΫΛػೳͤ͞ΔͨΊʹΠϯ ϥΠϯԽΛແޮʹ͢Δ͜ͱଞͷϕϯ νϚʔΫʹӨڹ͕͋ΔͷͰ͓͢͢Ί ͠·ͤΜɻ্̎ͭίϯύΠϥ͕ϧʔ ϓຊମΛ࠷దԽͰ͖ͳ͍Α͏ʹ͢Δͨ Ίͷਪํ๏Ͱ͢ɻ compiler optimisations Ὂ
QBHF JOMJOJOHͳͲͷίϯύΠϥ࠷దԽͷঢ়گΛ֬ೝ͢ΔʹHDqBHTΛ͍·͢ɻ -gcflags Ὂ
QBHF ͞ΒʹڧྗͳJOMJOJOH͕(P͔ΒೖͬͯΔ IUUQTEPDTHPPHMFDPNQSFTFOUBUJPOE8DCMQKQGF,X":'0NK18.@RN/RM2L/B-K1PFEJUTMJEFJEQ Mid Stack inlining Ὂ
QBHF Conclusion \
QBHF (Pʹ͓͚ΔϕϯνϚʔΫ؆୯ʹऔΕΔ͕ɺ͍ํʹҙ͕ඞཁɻ ϕϯνϚʔΫͷڥͷఏࣔ౷Ұ ϕϯνϚʔΫͷ҆ఆੑͷ֬ೝ ͓͔͍͘͠Β͍͍࣌ϕϯνϚʔΫ࣌ͷίϯύΠϥ࠷దԽͷڍಈΛ֬ೝ Conclusion Ὂ
QBHF Additional Talk \
QBHF (P$POGFSFODF'VLVPLB Ͱొஃ͠·͢ʂ
Benchmark and Compiler Optimization In Go Go Un Conference May
27, 2019 @ po3rin