SlideShare a Scribd company logo

Pragmatic Performance from NDC Oslo 2019

Slides from my talk from NDC Oslo 2019, Pragmatic Performance.

1 of 32
Download to read offline
NDC { Oslo }
2019
David Wengier
Microsoft
@davidwengier
@davidwengier
- Donald Knuth
@davidwengier
- Donald Knuth
@davidwengier
We should forget about small efficiencies, say about
97% of the time: premature optimization is the root
of all evil. Yet we should not pass up our opportunities
in that critical 3%”
- Donald Knuth
@davidwengier
We should forget about small efficiencies, say about
97% of the time: premature optimization is the root
of all evil. Yet we should not pass up our opportunities
in that critical 3%”
- Donald Knuth
“Structured Programming with Go To Statements”, 1974@davidwengier
Ad

Recommended

Pragmatic Performance from NDC London 2019
Pragmatic Performance from NDC London 2019Pragmatic Performance from NDC London 2019
Pragmatic Performance from NDC London 2019David Wengier
 
JDD 2015: Artificial intelligence. Status report. - Tomasz Jackowiak
JDD 2015: Artificial intelligence. Status report. - Tomasz Jackowiak JDD 2015: Artificial intelligence. Status report. - Tomasz Jackowiak
JDD 2015: Artificial intelligence. Status report. - Tomasz Jackowiak PROIDEA
 
One CMS Does Not Fit All
One CMS Does Not Fit AllOne CMS Does Not Fit All
One CMS Does Not Fit AllRhyne Armstrong
 
Are You Finding True Root Causes?
Are You Finding True Root Causes?Are You Finding True Root Causes?
Are You Finding True Root Causes?EMMAIntl
 
What is "Domain Driven Design" and what can you expect from it?
What is "Domain Driven Design" and what can you expect from it?What is "Domain Driven Design" and what can you expect from it?
What is "Domain Driven Design" and what can you expect from it?Tom Janssens
 
Testing, Learning and Professionalism — 20171214
Testing, Learning and Professionalism — 20171214Testing, Learning and Professionalism — 20171214
Testing, Learning and Professionalism — 20171214David Rodenas
 
Don't let your tests slow you down
Don't let your tests slow you downDon't let your tests slow you down
Don't let your tests slow you downDaniel Irvine
 

More Related Content

Similar to Pragmatic Performance from NDC Oslo 2019

Performance and Benchmarking
Performance and BenchmarkingPerformance and Benchmarking
Performance and BenchmarkingDavid Wengier
 
Grails Worst Practices
Grails Worst PracticesGrails Worst Practices
Grails Worst PracticesBurt Beckwith
 
Marie Astrid Molina (Scaleway), How to Design for a Product You Understand No...
Marie Astrid Molina (Scaleway), How to Design for a Product You Understand No...Marie Astrid Molina (Scaleway), How to Design for a Product You Understand No...
Marie Astrid Molina (Scaleway), How to Design for a Product You Understand No...Techsylvania
 
11 Amazing things I Learnt At Word Camp Sydney 2014
11 Amazing things I Learnt At Word Camp Sydney 201411 Amazing things I Learnt At Word Camp Sydney 2014
11 Amazing things I Learnt At Word Camp Sydney 2014WordPressBrisbane
 
TDD on android. Why and How? (Coding Serbia 2019)
TDD on android. Why and How? (Coding Serbia 2019)TDD on android. Why and How? (Coding Serbia 2019)
TDD on android. Why and How? (Coding Serbia 2019)Danny Preussler
 
Global Day of Coderetreat'14 - Istanbul Event
Global Day of Coderetreat'14 - Istanbul EventGlobal Day of Coderetreat'14 - Istanbul Event
Global Day of Coderetreat'14 - Istanbul EventLemi Orhan Ergin
 
Design patterns - The Good, the Bad, and the Anti-Pattern
Design patterns -  The Good, the Bad, and the Anti-PatternDesign patterns -  The Good, the Bad, and the Anti-Pattern
Design patterns - The Good, the Bad, and the Anti-PatternBarry O Sullivan
 
Dances with unicorns
Dances with unicornsDances with unicorns
Dances with unicornsEspritAgile
 
Agile is a 4 letter word - dev nexus 2020
Agile is a 4 letter word - dev nexus 2020Agile is a 4 letter word - dev nexus 2020
Agile is a 4 letter word - dev nexus 2020Jen Krieger
 
Cinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patternsCinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patternsSteven Smith
 
Practical DMD Scripting
Practical DMD Scripting Practical DMD Scripting
Practical DMD Scripting Zenoss
 
Asynchronous single page applications without a line of HTML or Javascript, o...
Asynchronous single page applications without a line of HTML or Javascript, o...Asynchronous single page applications without a line of HTML or Javascript, o...
Asynchronous single page applications without a line of HTML or Javascript, o...Robert Schadek
 
Вредные советы .NET разработчикам, Сергей Калинец
Вредные советы .NET разработчикам, Сергей КалинецВредные советы .NET разработчикам, Сергей Калинец
Вредные советы .NET разработчикам, Сергей КалинецSigma Software
 
FluentMigrator - Dayton .NET - July 2023
FluentMigrator - Dayton .NET - July 2023FluentMigrator - Dayton .NET - July 2023
FluentMigrator - Dayton .NET - July 2023Matthew Groves
 
10 Big Ideas from Industry
10 Big Ideas from Industry10 Big Ideas from Industry
10 Big Ideas from IndustryGarth Gilmour
 
The Most Important Thing: How Mozilla Does Security and What You Can Steal
The Most Important Thing: How Mozilla Does Security and What You Can StealThe Most Important Thing: How Mozilla Does Security and What You Can Steal
The Most Important Thing: How Mozilla Does Security and What You Can Stealmozilla.presentations
 
Driving application development through behavior driven development
Driving application development through behavior driven developmentDriving application development through behavior driven development
Driving application development through behavior driven developmentEinar Ingebrigtsen
 
The hunt of the unicorn, to capture productivity
The hunt of the unicorn, to capture productivityThe hunt of the unicorn, to capture productivity
The hunt of the unicorn, to capture productivityBrainhub
 

Similar to Pragmatic Performance from NDC Oslo 2019 (20)

Performance and Benchmarking
Performance and BenchmarkingPerformance and Benchmarking
Performance and Benchmarking
 
Grails Worst Practices
Grails Worst PracticesGrails Worst Practices
Grails Worst Practices
 
Marie Astrid Molina (Scaleway), How to Design for a Product You Understand No...
Marie Astrid Molina (Scaleway), How to Design for a Product You Understand No...Marie Astrid Molina (Scaleway), How to Design for a Product You Understand No...
Marie Astrid Molina (Scaleway), How to Design for a Product You Understand No...
 
11 Amazing things I Learnt At Word Camp Sydney 2014
11 Amazing things I Learnt At Word Camp Sydney 201411 Amazing things I Learnt At Word Camp Sydney 2014
11 Amazing things I Learnt At Word Camp Sydney 2014
 
TDD on android. Why and How? (Coding Serbia 2019)
TDD on android. Why and How? (Coding Serbia 2019)TDD on android. Why and How? (Coding Serbia 2019)
TDD on android. Why and How? (Coding Serbia 2019)
 
Global Day of Coderetreat'14 - Istanbul Event
Global Day of Coderetreat'14 - Istanbul EventGlobal Day of Coderetreat'14 - Istanbul Event
Global Day of Coderetreat'14 - Istanbul Event
 
Design patterns - The Good, the Bad, and the Anti-Pattern
Design patterns -  The Good, the Bad, and the Anti-PatternDesign patterns -  The Good, the Bad, and the Anti-Pattern
Design patterns - The Good, the Bad, and the Anti-Pattern
 
Dances with unicorns
Dances with unicornsDances with unicorns
Dances with unicorns
 
Agile is a 4 letter word - dev nexus 2020
Agile is a 4 letter word - dev nexus 2020Agile is a 4 letter word - dev nexus 2020
Agile is a 4 letter word - dev nexus 2020
 
Intro to Drush
Intro to DrushIntro to Drush
Intro to Drush
 
Cinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patternsCinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patterns
 
Practical DMD Scripting
Practical DMD Scripting Practical DMD Scripting
Practical DMD Scripting
 
Fantastic Elastic
Fantastic ElasticFantastic Elastic
Fantastic Elastic
 
Asynchronous single page applications without a line of HTML or Javascript, o...
Asynchronous single page applications without a line of HTML or Javascript, o...Asynchronous single page applications without a line of HTML or Javascript, o...
Asynchronous single page applications without a line of HTML or Javascript, o...
 
Вредные советы .NET разработчикам, Сергей Калинец
Вредные советы .NET разработчикам, Сергей КалинецВредные советы .NET разработчикам, Сергей Калинец
Вредные советы .NET разработчикам, Сергей Калинец
 
FluentMigrator - Dayton .NET - July 2023
FluentMigrator - Dayton .NET - July 2023FluentMigrator - Dayton .NET - July 2023
FluentMigrator - Dayton .NET - July 2023
 
10 Big Ideas from Industry
10 Big Ideas from Industry10 Big Ideas from Industry
10 Big Ideas from Industry
 
The Most Important Thing: How Mozilla Does Security and What You Can Steal
The Most Important Thing: How Mozilla Does Security and What You Can StealThe Most Important Thing: How Mozilla Does Security and What You Can Steal
The Most Important Thing: How Mozilla Does Security and What You Can Steal
 
Driving application development through behavior driven development
Driving application development through behavior driven developmentDriving application development through behavior driven development
Driving application development through behavior driven development
 
The hunt of the unicorn, to capture productivity
The hunt of the unicorn, to capture productivityThe hunt of the unicorn, to capture productivity
The hunt of the unicorn, to capture productivity
 

Recently uploaded

Embracing Change - The Impact of Generative AI on Strategic Portfolio Management
Embracing Change - The Impact of Generative AI on Strategic Portfolio ManagementEmbracing Change - The Impact of Generative AI on Strategic Portfolio Management
Embracing Change - The Impact of Generative AI on Strategic Portfolio ManagementOnePlan Solutions
 
DBA Fundamentals Group: Continuous SQL with Kafka and Flink
DBA Fundamentals Group: Continuous SQL with Kafka and FlinkDBA Fundamentals Group: Continuous SQL with Kafka and Flink
DBA Fundamentals Group: Continuous SQL with Kafka and FlinkTimothy Spann
 
Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)
Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)
Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)GDSCNiT
 
SPM 2024 – Overview of and benefits of AI in Product Management
SPM 2024 – Overview of and benefits of AI in Product ManagementSPM 2024 – Overview of and benefits of AI in Product Management
SPM 2024 – Overview of and benefits of AI in Product ManagementISPMAIndia
 
Product Manager vs Product Owner – Why Do Companies Still Struggle 23 Years A...
Product Manager vs Product Owner – Why Do Companies Still Struggle 23 Years A...Product Manager vs Product Owner – Why Do Companies Still Struggle 23 Years A...
Product Manager vs Product Owner – Why Do Companies Still Struggle 23 Years A...ISPMAIndia
 
Sql server types of joins with example.pptx
Sql server types of joins with example.pptxSql server types of joins with example.pptx
Sql server types of joins with example.pptxsameer gaikwad
 
Automation for Bonterra Impact Management (fka Apricot)
Automation for Bonterra Impact Management (fka Apricot)Automation for Bonterra Impact Management (fka Apricot)
Automation for Bonterra Impact Management (fka Apricot)Jeffrey Haguewood
 
Essence of Requirements Engineering: Pragmatic Insights for 2024
Essence of Requirements Engineering: Pragmatic Insights for 2024Essence of Requirements Engineering: Pragmatic Insights for 2024
Essence of Requirements Engineering: Pragmatic Insights for 2024Asher Sterkin
 
LLMOps with Azure Machine Learning prompt flow
LLMOps with Azure Machine Learning prompt flowLLMOps with Azure Machine Learning prompt flow
LLMOps with Azure Machine Learning prompt flowNaoki (Neo) SATO
 
AI Product Management by Abhijit Bendigiri
AI Product Management by Abhijit BendigiriAI Product Management by Abhijit Bendigiri
AI Product Management by Abhijit BendigiriISPMAIndia
 
No more Dockerfiles? Buildpacks to help you ship your image!
No more Dockerfiles? Buildpacks to help you ship your image!No more Dockerfiles? Buildpacks to help you ship your image!
No more Dockerfiles? Buildpacks to help you ship your image!Anthony Dahanne
 
sql ppt for students who preparing for sql
sql ppt for students who preparing for sqlsql ppt for students who preparing for sql
sql ppt for students who preparing for sqlbharatjanadharwarud
 
OpenChain AI Study Group - North America and Europe - 2024-02-20
OpenChain AI Study Group - North America and Europe - 2024-02-20OpenChain AI Study Group - North America and Europe - 2024-02-20
OpenChain AI Study Group - North America and Europe - 2024-02-20Shane Coughlan
 
killing camp week 6 problem - maximal matrix.pdf
killing camp week 6 problem - maximal matrix.pdfkilling camp week 6 problem - maximal matrix.pdf
killing camp week 6 problem - maximal matrix.pdfssuser82c38d
 
100 TOOLS TO MEASURE AND ANALYSE YOUR DIGITAL MARKETING EFFORTS
100 TOOLS TO MEASURE AND ANALYSE YOUR DIGITAL MARKETING EFFORTS100 TOOLS TO MEASURE AND ANALYSE YOUR DIGITAL MARKETING EFFORTS
100 TOOLS TO MEASURE AND ANALYSE YOUR DIGITAL MARKETING EFFORTSi-engage
 
Getting Started with Trello for Beginners.pptx
Getting Started with Trello for Beginners.pptxGetting Started with Trello for Beginners.pptx
Getting Started with Trello for Beginners.pptxmavinoikein
 
"Discovery and Delivery through Product IntelliGenAI framework" by Ramkumar A...
"Discovery and Delivery through Product IntelliGenAI framework" by Ramkumar A..."Discovery and Delivery through Product IntelliGenAI framework" by Ramkumar A...
"Discovery and Delivery through Product IntelliGenAI framework" by Ramkumar A...ISPMAIndia
 
P1 Inspection Types in Municity 5 Smartsheet
P1 Inspection Types in Municity 5 SmartsheetP1 Inspection Types in Municity 5 Smartsheet
P1 Inspection Types in Municity 5 SmartsheetMatthewTHawley
 
Software Testing life cycle (STLC) Importance, Phases, Benefits...
Software Testing life cycle (STLC) Importance, Phases, Benefits...Software Testing life cycle (STLC) Importance, Phases, Benefits...
Software Testing life cycle (STLC) Importance, Phases, Benefits...Flexsin
 

Recently uploaded (20)

Embracing Change - The Impact of Generative AI on Strategic Portfolio Management
Embracing Change - The Impact of Generative AI on Strategic Portfolio ManagementEmbracing Change - The Impact of Generative AI on Strategic Portfolio Management
Embracing Change - The Impact of Generative AI on Strategic Portfolio Management
 
DBA Fundamentals Group: Continuous SQL with Kafka and Flink
DBA Fundamentals Group: Continuous SQL with Kafka and FlinkDBA Fundamentals Group: Continuous SQL with Kafka and Flink
DBA Fundamentals Group: Continuous SQL with Kafka and Flink
 
Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)
Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)
Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)
 
eLearning Content Development Company Code and Pixels.pdf
eLearning Content Development Company Code and Pixels.pdfeLearning Content Development Company Code and Pixels.pdf
eLearning Content Development Company Code and Pixels.pdf
 
SPM 2024 – Overview of and benefits of AI in Product Management
SPM 2024 – Overview of and benefits of AI in Product ManagementSPM 2024 – Overview of and benefits of AI in Product Management
SPM 2024 – Overview of and benefits of AI in Product Management
 
Product Manager vs Product Owner – Why Do Companies Still Struggle 23 Years A...
Product Manager vs Product Owner – Why Do Companies Still Struggle 23 Years A...Product Manager vs Product Owner – Why Do Companies Still Struggle 23 Years A...
Product Manager vs Product Owner – Why Do Companies Still Struggle 23 Years A...
 
Sql server types of joins with example.pptx
Sql server types of joins with example.pptxSql server types of joins with example.pptx
Sql server types of joins with example.pptx
 
Automation for Bonterra Impact Management (fka Apricot)
Automation for Bonterra Impact Management (fka Apricot)Automation for Bonterra Impact Management (fka Apricot)
Automation for Bonterra Impact Management (fka Apricot)
 
Essence of Requirements Engineering: Pragmatic Insights for 2024
Essence of Requirements Engineering: Pragmatic Insights for 2024Essence of Requirements Engineering: Pragmatic Insights for 2024
Essence of Requirements Engineering: Pragmatic Insights for 2024
 
LLMOps with Azure Machine Learning prompt flow
LLMOps with Azure Machine Learning prompt flowLLMOps with Azure Machine Learning prompt flow
LLMOps with Azure Machine Learning prompt flow
 
AI Product Management by Abhijit Bendigiri
AI Product Management by Abhijit BendigiriAI Product Management by Abhijit Bendigiri
AI Product Management by Abhijit Bendigiri
 
No more Dockerfiles? Buildpacks to help you ship your image!
No more Dockerfiles? Buildpacks to help you ship your image!No more Dockerfiles? Buildpacks to help you ship your image!
No more Dockerfiles? Buildpacks to help you ship your image!
 
sql ppt for students who preparing for sql
sql ppt for students who preparing for sqlsql ppt for students who preparing for sql
sql ppt for students who preparing for sql
 
OpenChain AI Study Group - North America and Europe - 2024-02-20
OpenChain AI Study Group - North America and Europe - 2024-02-20OpenChain AI Study Group - North America and Europe - 2024-02-20
OpenChain AI Study Group - North America and Europe - 2024-02-20
 
killing camp week 6 problem - maximal matrix.pdf
killing camp week 6 problem - maximal matrix.pdfkilling camp week 6 problem - maximal matrix.pdf
killing camp week 6 problem - maximal matrix.pdf
 
100 TOOLS TO MEASURE AND ANALYSE YOUR DIGITAL MARKETING EFFORTS
100 TOOLS TO MEASURE AND ANALYSE YOUR DIGITAL MARKETING EFFORTS100 TOOLS TO MEASURE AND ANALYSE YOUR DIGITAL MARKETING EFFORTS
100 TOOLS TO MEASURE AND ANALYSE YOUR DIGITAL MARKETING EFFORTS
 
Getting Started with Trello for Beginners.pptx
Getting Started with Trello for Beginners.pptxGetting Started with Trello for Beginners.pptx
Getting Started with Trello for Beginners.pptx
 
"Discovery and Delivery through Product IntelliGenAI framework" by Ramkumar A...
"Discovery and Delivery through Product IntelliGenAI framework" by Ramkumar A..."Discovery and Delivery through Product IntelliGenAI framework" by Ramkumar A...
"Discovery and Delivery through Product IntelliGenAI framework" by Ramkumar A...
 
P1 Inspection Types in Municity 5 Smartsheet
P1 Inspection Types in Municity 5 SmartsheetP1 Inspection Types in Municity 5 Smartsheet
P1 Inspection Types in Municity 5 Smartsheet
 
Software Testing life cycle (STLC) Importance, Phases, Benefits...
Software Testing life cycle (STLC) Importance, Phases, Benefits...Software Testing life cycle (STLC) Importance, Phases, Benefits...
Software Testing life cycle (STLC) Importance, Phases, Benefits...
 

Pragmatic Performance from NDC Oslo 2019

  • 1. NDC { Oslo } 2019 David Wengier Microsoft @davidwengier
  • 5. We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%” - Donald Knuth @davidwengier
  • 6. We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%” - Donald Knuth “Structured Programming with Go To Statements”, 1974@davidwengier
  • 10. “Don’t do that, that’s slow, and uses too much memory!” @davidwengier
  • 11. public static void Profile(Action func) { DateTime start = DateTime.Now; for (int i = 0; i < 100; i++) { func(); } Console.WriteLine(“Avg Time Elapsed {0} ms", (DateTime.Now - start).TotalMilliseconds / 100); }
  • 12. public static void Profile(Action func) { Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High; Thread.CurrentThread.Priority = ThreadPriority.Highest; func(); Stopwatch watch = new Stopwatch(); GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); watch.Start(); for (int i = 0; i < 100; i++) { func(); } watch.Stop(); Console.WriteLine(“Avg Time Elapsed {0} ms", watch.Elapsed.TotalMilliseconds / 100); }
  • 21. 0 bytes allocated 32 bytes allocated
  • 24. 0 bytes 20 bytes 32 bytes
  • 29. public class HybridDictionary: IDictionary { // These numbers have been carefully tested to be optimal. // Please don't change them without doing thorough performance // testing. private const int CutoverPoint = 9;
  • 30. • Should you always use Dictionary<K,V> instead of IDictionary<K,V>? • Should you always use structs instead of classes? • Should you always use for instead of foreach? • Should you always use StringBuilder instead of concatenation? • Should you always use traditional loops instead of Linq? • Should you always avoid throwing exceptions?
  • 31. • Should you always use Dictionary<K,V> instead of IDictionary<K,V>? No, it depends. • Should you always use structs instead of classes? No, it depends. • Should you always use for instead of foreach? No, it depends. • Should you always use StringBuilder instead of concatenation? No, it depends. • Should you always use traditional loops instead of Linq? No, it depends. • Should you always avoid throwing exceptions? No, it depends. • Should you always … anything? No, it probably depends.

Editor's Notes

  1. Whos heard this? This gets carted out on PRs, and usually as a negative. Either someone changes a linq statement to foreach statement, and someone else says “don’t bother, premature opt…”. Or someone writes a linq statement, someone comments saying it should be a foreach statement, and then in order to be lazy, “premature opt..” But first, Who said it?
  2. Donald Knuth. K-nooth. You may notice the formatting is odd.. Well, that’s because its part of a bigger quote
  3. Most people don’t know this. 97% of the time its evil, the rest its not. But why? Notice the quotes.
  4. Consider maintenance and debugging. Readability. Etc. Bonus points, what paper was it from?
  5. Ironically, a quote that lots of developers spout as being gospel comes from a paper arguing that programming with go to statements is perfectly fine. A debate for another time.
  6. How much? How often?
  7. Questions assumptions: “the compiler will fix this”. Will it? Release builds only!
  8. Measure. Before and After.
  9. DateTime is as precise as stopwatch, but not as granular Doesn’t account for JITing
  10. High affinity, so nothing else on the machine matters (hopefully) JIT first Get GC out of the way, because GC pauses are bad for benchmarking Then go
  11. Or use BenchmarkDotNet
  12. So I’ve told you how to benchmark, and that you should basically never do it, so lets do it.
  13. Except its too slow. Its _thorough_ BenchmarkDotNet is too awesome for live demos. I have some canned ones.
  14. Concat wins Then stringbuilder StringBuilder again Now StringBuilder with capacity, and that trend continues forever If we add more, we can see stringbuilder and string join are both a lot fast As we keep going, the difference gets bigger Looks like a slam dunk right? Always use a string builder with capacity? BUT- don’t forget context!!! Look what happens as the strings get longer. Now it doesn’t matter so much, as long as you don’t concatenate
  15. Back to context, again production code.. For 3 small strings, concatenation is slower, but not measurably so. But it uses less memory. The overhead of StringBuilder might make it a winner. For large strings, not so. Stopwatch granularity is around 300ns, so the difference in the first one is effectively unmeasurable in production .NET code. For large strings SB still uses heaps of memory. Are strings the best thing to use at all? Step back
  16. The overhead of a class vs struct, virtual calls, etc. makes the difference. So if you use Idictionary as your parameters are you’re supposed to do, on a hot path that might be a negative. Question assumptions.. How many of you think “coding to interfaces” is _always_ better?
  17. I’m an old man so I like loops, but Linq has an overhead.
  18. Overhead in method invocations and allocations. Even the Where vs FirstOrDefault examples, because there are more iterators being allocated. Where uses an iterator, FirstOrDefault uses a foreach loop
  19. 50% chance of having an invalid number. The important thing is that both benchmarks will use exactly the same input.
  20. Question assumptions!
  21. Culture of performance means measure, not necessarily write complicated code
  22. Pragmatic. Every decision is unique. Don’t write off performance, but don’t write off anything.