net performance tips #visualized

16
.NET Performance Tips #VISUALIZED Igal Tabachnik @hmemcpy

Upload: igal-tabachnik

Post on 12-Jul-2015

193 views

Category:

Software


1 download

TRANSCRIPT

Page 1: NET Performance Tips #Visualized

.NET Performance Tips#VISUALIZED

Igal Tabachnik

@hmemcpy

Page 2: NET Performance Tips #Visualized

WoW – Word of Warning

•10 PREMATURE OPTIMIZATION' …is the root of all evil (mostly)

•20 MEASURE ALL THE THINGS' otherwise, you’re guessing

•30 GOTO 10

Page 3: NET Performance Tips #Visualized

High Memory Traffic

• Garbage Collection (GC) internals are unknown to the public (yet). Only the CLR team knows what’s really going on.

• Gen0 -> Gen1 -> Gen2

• More memory traffic = more GC time/app freeze/OOM

Page 4: NET Performance Tips #Visualized

Memory Traffic: GC Pressure

•Hidden allocations

•Boxing

•Other stuff

Page 5: NET Performance Tips #Visualized

LINQ

Page 6: NET Performance Tips #Visualized
Page 7: NET Performance Tips #Visualized

More LINQ

Page 8: NET Performance Tips #Visualized
Page 9: NET Performance Tips #Visualized

params

Page 10: NET Performance Tips #Visualized

params – decompiled

Page 11: NET Performance Tips #Visualized

IEnumerable<T> vs List<T>

Page 12: NET Performance Tips #Visualized

IEnumerable<T> vs List<T>

Page 13: NET Performance Tips #Visualized

/j #DEMO

Page 14: NET Performance Tips #Visualized

GC.Collect()

GOTO 10

Page 15: NET Performance Tips #Visualized

Finalize()

•Google:

• “resharper heapview”

• “roslyn perf tips” (bit.ly/dotnet-perf)

• “download ozcode” :)

Page 16: NET Performance Tips #Visualized

THANK YOU!

•/msg nickserv +twitter @hmemcpy

• /msg nickserv +email [email protected]