Тёмный

Getting the most out of dead code elimination - Alessandro Arzilli 

GoLab conference
Подписаться 3,3 тыс.
Просмотров 122
50% 1

🔔 FOLLOW GOLAB CHANNEL 🔔
ABSTRACT:
The Go linker tries to remove functions that are never called in a step called "deadcode elimination". During this step the linker visits the symbol graph, starting from the entry point of the program, and marks every reachable symbol, i.e. everything that is called either directly or indirectly, through a function pointer or through an interface. All unreachable symbols are then removed and will not be included in the final executable.
However if during this process if the linker sees that one of the following methods are reachable:
- reflect.Value.Method
- reflect.Value.MethodByName
- reflect.Type.Method
- reflect.Type.MethodByName
then a more relaxed version of deadcode elimination is run and every exported method of any reachable type is considered reachable. This is done because, when using one of those methods, it is possible for the program to call an arbitrary method of any reachable type, dependent on input seen at runtime.
It is possible to determine if this degraded version of deadcode elimination is being used by examining the output of the `-dumpdep` flag of the linker. This can also be used to determine where the problem lies in a program with many dependencies.
In many cases these problematic reflection methods can be avoided without loss of functionality and without breaking backwards compatibility. I will show how to do this using the real world examples of three popular projects: Delve, Cobra and Starlark.
This channel is dedicated to the videos of the GoLab conference.
💛 Follow us on TWITTER:
/ golab_conf
💜 Follow us on FACEBOOK:
/ golabconf
GoLab is the first Italian international conference on the Go programming language, organized by Develer.
Develer is not just an Italian company projecting and releasing hardware and software solutions for the industrial environment, but is also an ensemble of people sharing their great passion for new technologies and how they can be applied to your everyday life.
🔸 Follow DEVELER on INSTAGRAM:
/ wearedeveler
🔹 Follow DEVELER on FACEBOOK:
/ we.are.develer
🔸 Follow DEVELER on TWITTER:
/ develer
🔹 Follow DEVELER on LINKEDIN:
/ 114426
🔸 Follow DEVELER on TELEGRAM: t.me/wearedeveler
🔹 Follow DEVELER on TIK TOK:
/ wearedeveler

Опубликовано:

 

8 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии    
Далее
Safe by construction - Roberto Clapis
52:21
Сказала дочке НЕТ!
00:24
Просмотров 1,1 млн
IT'S MY LIFE + WATER  #drumcover
00:14
Просмотров 18 млн
Writing Awesome Command-Line Programs in Python
41:25
Просмотров 128 тыс.
Putting the R in R&D - Eleanor McHugh
1:04:37
The job of Go maintainer - Filippo Valsorda
53:34