Igor Ostrovsky on August 24th, 2010

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

Igor Ostrovsky on July 2nd, 2010

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

Igor Ostrovsky on March 12th, 2010

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

Igor Ostrovsky on February 23rd, 2010

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. For example, if one thread updates a regular non-volatile field, it is possible that another thread reading […]

Continue reading about Volatile keyword in C# – memory model explained

Igor Ostrovsky on February 9th, 2010

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 take a deeper look at the sequence of events that take place when you visit a URL. […]

Continue reading about What really happens when you navigate to a URL

Igor Ostrovsky on January 19th, 2010

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 […]

Continue reading about Gallery of Processor Cache Effects