We’re happy to share that we’ll be publishing High-Performance Windows Store Apps, by Microsoft’s Brian Rasmussen, next month. And today we’d like to share the book’s Foreword, graciously provided by Eric Lippert. Enjoy:
Which is faster, dividing by four or shifting by two?
Should I make this array of ten numbers shorts instead of ints to save on space?
What are your favorite tips and tricks for speeding up programs?
I get a lot of questions like these from real-world developers who think they might have performance problems. Though those developers mean well, these are almost always the wrong questions to ask! Why? Because knowing the answers will not actually lead to improvements that any user will notice. A program which downloads and displays a hundred million bytes of video from a server on the other side of the world is not going to suddenly become smooth and fluid because you saved a couple nanoseconds in one math routine or trimmed twenty bytes from an array. Rather, getting good performance is about setting user-focused goals, asking the right questions, using the best possible diagnostic tools to get objective answers, and having the engineering discipline necessary to build a high-performance product every day of the development process.
Brian Rasmussen knows all this inside out. He and I spent many years working together on the Roslyn project at Microsoft: a complete from-scratch rewrite of the C# and Visual Basic compilers and IDEs. The user-focused performance requirements of this project were daunting: we had to be able to perform an accurate analysis of potentially millions of lines of code in the time between keystrokes so that the right IntelliSense information could be displayed in the IDE as you type. We were limited to a 32-bit address space shared with the rest of Visual Studio. There is no way we could have achieved our lofty time and memory performance goals without using many of the solid engineering techniques described in this book. With these techniques you too can succeed in amazing your users with beautiful, fast, fluid, efficient applications.
Good luck, and go fast!