Do you know whether this inequality is true? It’s a simple question, but with an intriguing and revealing answer. Infinity #1 One concept of infinity that most people would have encountered in a math class is the infinity of limits. With limits, we can try to understand 2∞ as follows: The infinity symbol is used [...]
Continue reading about Is two to the power of infinity more than infinity?
If you had to come up with a way to represent signed integers in 32-bits, how would you do it? One simple solution would be to use one bit to represent the sign, and the remaining 31 bits to represent the absolute value of the number. But as many intuitive solutions, this one is not [...]
Continue reading about Why computers represent signed integers using two’s complement
Imagine that 90,000 years ago, every man alive at the time picked a different last name. Assuming that last names are inherited from father to son, how many different last names do you think there would be today? It turns out that there would be only one last name! Similarly, imagine that 200,000 years ago, [...]
Continue reading about Graphs, trees, and origins of humanity
Did you know that the performance of an if-statement depends on whether its condition has a predictable pattern? If the condition is always true or always false, the branch prediction logic in the processor will pick up the pattern. On the other hand, if the pattern is unpredictable, the if-statement will be much more expensive. [...]
Continue reading about Fast and slow if-statements: branch prediction in modern processors
Sometimes you need to access private fields and call private methods on an object – for testing, experimentation, or to work around issues in third-party libraries. .NET has long provided a solution to this problem: reflection. Reflection allows you to call private methods and read or write private fields from outside of the class, but [...]
Continue reading about Use C# dynamic typing to conveniently access internals of an object
The story of how GPU came to be used for high-performance computation is pretty cool. Hardware heavily optimized for graphics turned out to be useful for another use: certain types of high-performance computations. In this article, I will explore how and why this happened, and summarize the state of general computation on GPUs today. Programmable [...]
Continue reading about How GPU came to be used for general computation
div.mynote { border: black 1px solid; padding: 10px; background-color: #f0f0ff; margin-top: 20px; margin-bottom: 20px; margin-left: 10px; > The memory model is a fascinating topic – it touches on hardware, concurrency, compiler optimizations, and even math. The memory model defines what state a thread may see when it reads a memory location modified by other threads. [...]
Continue reading about Volatile keyword in C# – memory model explained
div.mynote { border: black 1px solid; padding: 10px; background-color: #f0f0ff; margin-top: 20px; margin-bottom: 20px; margin-left: 10px; > As a software developer, you certainly have a high-level picture of how web apps work and what kinds of technologies are involved: the browser, HTTP, HTML, web server, request handlers, and so on. In this article, we will [...]
Continue reading about What really happens when you navigate to a URL
Most of my readers will understand that cache is a fast but small type of memory that stores recently accessed memory locations. This description is reasonably accurate, but the “boring” details of how processor caches work can help a lot when trying to understand program performance. In this blog post, I will use code samples [...]
PDC 2009 was an exciting event, with announcements about Azure, Silverlight 4, and Office 2010 popping up one after another. For me, there was another reason why this year’s PDC was exciting – it was my first chance to present in a major conference.
Continue reading about Video of my PLINQ session at PDC 2009
Recent Comments