0% found this document useful (0 votes)
3 views

understanding-how-things-work-to-improve-performance-slides

The document discusses the importance of understanding programming languages, particularly C#, and their performance implications, including the role of intermediate language (IL) and database indexing. It emphasizes the need for proper coding practices, such as unit testing and performance integration tests, to isolate and diagnose performance issues. Key takeaways include the significance of knowing what happens under the hood of your code and the differences between debug and release configurations.

Uploaded by

Oliver Castro
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

understanding-how-things-work-to-improve-performance-slides

The document discusses the importance of understanding programming languages, particularly C#, and their performance implications, including the role of intermediate language (IL) and database indexing. It emphasizes the need for proper coding practices, such as unit testing and performance integration tests, to isolate and diagnose performance issues. Key takeaways include the significance of knowing what happens under the hood of your code and the differences between debug and release configurations.

Uploaded by

Oliver Castro
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Understanding How

Things Work
to Improve Performance

Chris B. Behrens

@chrisbbehrens
What language should I
learn?

What language should I


learn…first?
Which Sort of Performance?

How these high-level


What works in C# might not
technologies work under the
work in other languages
covers matters
Intermediate Language Code
Syntactic Sugar and Compilation

Shorthand for lower- What does “later on” When we compile and
level code mean? target the CLR
What Does ‘Intermediate’ Mean?

Lower than C# Higher than the binary


ILDASM – the command line tool for
Demo working with IL in .NET
A property assignment
A direct assignment to a field
What IL each generates
What that means
C# is a high-level language
Databases and Indexing
Data Access and C#

Your data needs to be Your query is part


stored somewhere of your code
Unit Tests and Databases

Proper practice is to Because you’re trying to


mock the db isolate the code

This kind of problem can fall


You WILL face this problem
through the cracks
Isolating the Performance
of the Database

You determine that the problem is Any good dba will stop you from
happening only in Production debugging the Production db
Choose Your Own Solution

Performance integration tests at the point of deployment

Sanitized production backups

Code and tools in the Production zone

Use the database tools to diagnose the database


A query against a Microsoft
sample database
Benchmark it
Review the query in the tools
Make an adjustment to the database
Re-run our benchmark
Begin with the assumption
that there’s a missing or
improperly constructed
index
The Profile Tools in Visual Studio
Demo
Look at what they measure
The role they play
I’m not a big fan of these tools
But I’ve included them for
completeness’ sake
The Role of These Tools

The view is too high a level to


I don’t use them
be useful for what I do
Demo
A LINQ query that is backed by a database
We’ll benchmark it two ways
Look at the results
Analyze why one works so much better
Key Takeaways

Know what’s going on under That code will always pass


the covers unit testing
What Debug vs. Release Really Means
Optimizing Code

The code must be reasonably one-to-one


to debug
“Cannot obtain value of local or
argument as it is not available at
this instruction pointer, possibly
because it has been optimized away”
Even without optimizations, the debugger
needs a map to follow
PDB – Program Database files

Even TypeScript has debug symbols


In Debug configuration, the
audience is the Developer.
In Release, it’s the CLR
Intermediate Language

Wrap-up What it looks like


The importance of indexing on databases
The Profile tools
The importance of understanding where
your LINQ is executing
The difference between Debug
and Release

You might also like