voedger / kb

Knowledge base
0 stars 0 forks source link

golang: Show escape analysis results in VS Code sources (visualising escape analysis output) #13

Open maxim-ge opened 1 year ago

maxim-ge commented 1 year ago

Motivation

Have a greate command:

go build -gcflags "-m=3"

It has output like:

.\types.go:619:6: cannot inline (*rowType).HasValue: function too complex: cost 179 exceeds budget 80
.\types.go:635:39: inlining call to appdef.DefKind.HasSystemField
.\types.go:637:25: inlining call to dynobuffers.(*Buffer).HasValue
.\validation-errors.go:45:6: can inline validateError with cost 75 as: func(int, error) ValidateError { e := validateErrorType{...}; return e }
.\validation-errors.go:53:6: cannot inline validateErrorf: function too complex: cost 140 exceeds budget 80
.\validation-errors.go:54:22: inlining call to validateError
.\validation.go:397:6: cannot inline (*validators).validPKey: function too complex: cost 318 exceeds budget 80

Want the output to be mapped to the sources in the VS Code editor

Functional Design

Configure Tasks

Configure graphiz

See escapes as problems

F1 -> Tasks: Run task -> Go: Escape analysis, leaking + escapes

Result

![image](https://github.com/voedger/kb/assets/11589750/32b9ba04-d35c-40f2-a90e-1f415ab68493)

Get details for the current file + line

F1 -> Tasks: Run tasks -> Go: Escape analysis, detailed, for current file and line

Result

![image](https://github.com/voedger/kb/assets/11589750/ab5e55fb-8c02-4821-afeb-2efd1b5e0e56)

Cleanup PROBLEMS window

F1 -> Developer: Reload Window

Profile benchmarks

References