How To Write Very Fast C# Code

Mark Farragher, Microsoft Certified Trainer

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
23 Videos (3h 43m)
    • C# performance tips

      2:59
    • Introduction to code optimization

      6:12
    • What is stack memory?

      5:23
    • What is heap memory?

      6:18
    • What are value types?

      5:50
    • What are reference types?

      5:29
    • What is boxing and unboxing?

      6:28
    • What are immutable strings?

      6:43
    • A crash course in intermediate language

      14:45
    • Tip #1: prevent boxing and unboxing

      9:39
    • Tip #2: add strings together efficiently

      8:20
    • Tip #3: use the correct list class

      8:29
    • Tip #4: use the correct array type

      9:09
    • Tip #5: avoid throwing exceptions

      14:55
    • Tip #6: use for instead of foreach

      16:40
    • How does the garbage collector work?

      16:07
    • Tip #7: optimize for garbage collection

      18:26
    • Tip #8: use fast delegates

      9:13
    • Tip #9: build a fast class factory

      17:06
    • Are arrays on the stack worth the trouble?

      11:28
    • How do I use pointers in C#?

      10:05
    • Tip #10: speed up code with pointers

      11:43
    • Course recap

      1:44

About This Class

78e5abec

Do you know how to write fast C# code?

You may have already enrolled in a C# programming course, or learned the language at school or university. But here's a sobering fact: most courses only teach you how to write code, not how to write fast code.

The .NET Framework is huge. For any given problem there are many solutions, and it is not always clear which solution is the best choice.

Did you know that adding strings together the wrong way will slow down your code by a factor of more than two hundred? And if you're not handling exceptions the right way, your code wil run a mind-boggling thousand times slower than normal.

Slow C# code is a big problem. Slow code on the web will not scale to thousands of users. Slow code will make your user interface unusable. Slow code will make your mobile apps languish in the app store.

Slow code is holding you back!

I can help you.

In a series of short lectures I will cover many common performance bottlenecks. I will introduce each problem, and then write a small test program to measure the baseline performance. Then I will demonstrate each possible solution, and benchmark how each solution measures up.

But there's more! I will also dive into Common Intermediate Code (CIL), the language that the C# compiler compiles to. If this sounds daunting, don't worry! The CIL language is actually very easy to read and understand. I'll take you through the basics in a quick 15-minute lecture.

Being able to read CIL code is a very useful skill that will help you avoid many performance pitfalls and give you a deeper understanding of the .NET Framework.

Why should you take this course?

You should take this course if you are a beginner or intermediate C# developer and want to take your skills to the next level. All my lectures are very easy to follow, and I explain all topics with clear code and many instructive diagrams.

Or you might be working on a critical section of code in a C# project, and need to make your code run as fast as possible. The tips and tricks in this course will help you immensely.

Or maybe you're preparing for a C# related job interview? This course will give you an excellent foundation to answer any performance-related questions they might throw at you.

2

Students

--

Projects

0

Reviews (0)

Mark Farragher

Microsoft Certified Trainer

Mark Farragher is a blogger, investor, serial entrepreneur, and the author of 11 successful Udemy courses. He has been a Founder and CTO, and has launched two startups in the Netherlands. Mark became a Microsoft Certified Trainer in 2005. Today he uses his extensive knowledge to help tech professionals with their leadership, communication, and technical skills.

See full profile

Technology Mobile Development Csharp