-
Notifications
You must be signed in to change notification settings - Fork 127
/
lesson9.slide
44 lines (30 loc) · 1.02 KB
/
lesson9.slide
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Optimizations in Go
Lesson 9
30 May 2024
Tags: golang, go
Pavel Tišnovský
Red Hat, Inc.
https://github.com/RedHatOfficial/GoCourse
@RedHat
* Sources
- [[https://github.com/RedHatOfficial/GoCourse]]
.image ./common/qr_address.png
* Gophers
#The Go gopher was designed by Renee French. (http://reneefrench.blogspot.com/)
#Source https://golang.org/doc/gopher/fiveyears.jpg
#The design and this image is licensed under the Creative Commons 3.0 Attributions license.
.image ./common/fiveyears.jpg _ 900
* Optimizations in Go
- pass structures by reference, not by value
* Pass structures by reference, not by value
- all data types are passed by value into functions and methods
- that's good from "state-space" perspective
- not so good from performance point of view
- (and no nice solution like `const` and `mut` exists in Go)
* Problem definition
- Large structures passed by value everywhere in the code
- Even within inner loops
- It causes overhead that is easy to avoid
* Real example
* Is it worth to do it?