Slide 1

Slide 1 text

http://s3wf.com @jeffotoni 2019 BELO HORIZONTE 25/07 Jefferson Otoni Performance

Slide 2

Slide 2 text

@jeffotoni Benchmarks Use strings.Builder em Go 01 03 04 Otimizar programas Go 05 06 07 Use sync.Pool Como escrever benchmarks em Go 02 Pprof Evite usar map[string]int

Slide 3

Slide 3 text

- Compilada e estática - Gc (Garbage Collector) - Paradigma Concorrente - Tipagem estática - Semântica é clara - Sintaxe é limpa - É de uso Geral - Plataformas: Windows, Linux, Mac e FreeBSD Características

Slide 4

Slide 4 text

Use sync.Pool

Slide 5

Slide 5 text

reduzir número de alocações salvos

Slide 6

Slide 6 text

Evite usar map[string]int

Slide 7

Slide 7 text

lento fast

Slide 8

Slide 8 text

lento fast

Slide 9

Slide 9 text

use strings.Builder

Slide 10

Slide 10 text

fast lento

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

Use strconv

Slide 13

Slide 13 text

fast lento

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

Use Make evitar realocação

Slide 16

Slide 16 text

danger fast better good

Slide 17

Slide 17 text

Benchmark

Slide 18

Slide 18 text

“testing” *testing.B

Slide 19

Slide 19 text

*testing.T

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

pprof

Slide 22

Slide 22 text

-> go tool pprof --text ./gostring.test cpu.pprof -> pprof -http=localhost:6060 pprof-2 cpu.pprof

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

referências https://github.com/jeffotoni/goexample/tree/master/performance Sources da apresentação https://dave.cheney.net/2013/06/30/how-to-write-benchmarks-in-go https://golang.org/pkg/testing/ https://golang.org/pkg/net/http/pprof/ https://blog.golang.org/profiling-go-programs https://medium.com/justforfunc/analyzing-the-performance-of-go-functions-with-benchmarks-60b8162e61c6 links

Slide 27

Slide 27 text

Thanks := &Obrigado{...} Obrigado... github.com/jeffotoni instagram.com/jeffotoni https://t.me/devopsbh https://t.me/go_br https://t.me/awsbrasil linkedin.com/in/jeffotoni/