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
Go Performans Rehberi
Search
Oğuzhan
July 25, 2020
Technology
1
300
Go Performans Rehberi
https://gophercon.ist/
için hazırladığım sunum
Oğuzhan
July 25, 2020
Tweet
Share
More Decks by Oğuzhan
See All by Oğuzhan
Yazılımda Ustalaşmak
oguzhan
0
98
Kuşbakışı GO
oguzhan
2
380
Hayatınızı Değiştirecek 10 Araç (Hosting Meetup)
oguzhan
0
730
MaestroPanel HTK
oguzhan
0
55
Other Decks in Technology
See All in Technology
米国国防総省のDevSecOpsライフサイクルをAWSのセキュリティサービスとOSSで実現
syoshie
2
1.2k
監視のこれまでとこれから/sakura monitoring seminar 2025
fujiwara3
11
4k
Should Our Project Join the CNCF? (Japanese Recap)
whywaita
PRO
0
250
Tech-Verse 2025 Keynote
lycorptech_jp
PRO
0
950
Core Audio tapを使ったリアルタイム音声処理のお話
yuta0306
0
110
AIの最新技術&テーマをつまんで紹介&フリートークするシリーズ #1 量子機械学習の入門
tkhresk
0
140
rubygem開発で鍛える設計力
joker1007
2
220
プロダクトエンジニアリング組織への歩み、その現在地 / Our journey to becoming a product engineering organization
hiro_torii
0
130
AI導入の理想と現実~コストと浸透〜
oprstchn
0
120
Witchcraft for Memory
pocke
1
600
生成AI時代 文字コードを学ぶ意義を見出せるか?
hrsued
1
660
AIのAIによるAIのための出力評価と改善
chocoyama
2
590
Featured
See All Featured
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
The Invisible Side of Design
smashingmag
300
51k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
A designer walks into a library…
pauljervisheath
207
24k
Art, The Web, and Tiny UX
lynnandtonic
299
21k
Making the Leap to Tech Lead
cromwellryan
134
9.4k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
BBQ
matthewcrist
89
9.7k
Speed Design
sergeychernyshev
32
1k
Code Review Best Practice
trishagee
68
18k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Transcript
Oğuzhan Yılmaz Go Performans Rehberi
min. Go 1.14
if > switch
13.5 ns/op 15.5 ns/op
12.1 ns/op
strconv > fmt
BenchmarkStrconv-16 19381725 67.5 ns/op 32 B/op 1 allocs/op BenchmarkFmt-16 5839038
222 ns/op 72 B/op 3 allocs/op 67.5 ns/op
make([]int, 0, 10) > []int{}
BenchmarkMakeSliceWithCap-16 1000000000 0.234 ns/op 0 B/op 0 allocs/op BenchmarkMakeSlice-16 65739
17390 ns/op 16376 B/op 11 allocs/op 0.234 ns/op
strings.Builder > “a” + “b”
BenchmarkStringBuildNaive-16 6573120 174 ns/op 32 B/op 6 allocs/op BenchmarkStringBuildBuilder-16 19740784
62.4 ns/op 64 B/op 1 allocs/op 62.4 ns/op
bytes.Replace > strings.Replace bytes Concat > strings Concat bytes Concat
> strings Join
70.1 ns/op BenchmarkBytesReplace-4 20000000 70.1 ns/op 32 B/op 1 allocs/op
BenchmarkStringsReplace-4 10000000 132 ns/op 64 B/op 2 allocs/op
https://github.com/valyala/fasthttp
binary.BigEndian.PutUint32 > binary.Write
1075 ns/op 113 ns/op
sync.Pool
None
_ = make([]byte, 10<<30)
runtime.MemProfileRate = 0 https://golang.org/pkg/runtime/
syscal.SYS_MMAP
None
map[int]int{} > map[string]int{}
3 ms/op
json.Marshal(Struct) > json.Marshal(Map)
BenchmarkMarshallStruct-16 4721078 230 ns/op 64 B/op 2 allocs/op BenchmarkMakeSlice-16 1843551
665 ns/op 512 B/op 10 allocs/op 230 ns/op
Atomic > Mutex
BenchmarkIncrementMutex-16 87149690 12.3 ns/op 0 B/op 0 allocs/op BenchmarkIncrementMutexNoDefer-16 99812758
12.2 ns/op 0 B/op 0 allocs/op BenchmarkIncrementAtomic-16 286304998 4.19 ns/op 0 B/op 0 allocs/op BenchmarkConcurrentMutex-16 226051 5104 ns/op 16 B/op 1 allocs/op BenchmarkConcurrentMutexNoDefer-16 235743 4941 ns/op 16 B/op 1 allocs/op BenchmarkConcurrentAtomic-16 260210 4635 ns/op 16 B/op 1 allocs/op 4.19 ns/op
1. https://github.com/dgryski/go-perfbook/blob/master/performance.md 2. https://stephen.sh/posts/quick-go-performance-improvements 3. https://hashrocket.com/blog/posts/go-performance-observations 4. https://gist.github.com/vitalyisaev2/5791627ffc48f10c2fde22c2a5dd32ee