How many 64bit coders does it take to screw in a lightbulb?

1050 – or thereabouts.

OK I must admit that’s not entirely the question, but it is however the answer. As some of you out there know I’m working on the new version of ANTS Profiler (gratuitous link to product, marketing would be so proud) and in the course of my explorations I have of course been using a very simple test app just to sanity check the product as I’m developing it so I don’t give the testers a completely broken build.

One of the things this program does is a fairly innocent looking

Consle.WriteLine(1);

Well that shouldn’t be too painful and indeed on the 32 bit version of the Profiler it takes a fairly short amount of time. However on the 64 bit profiler it takes a little longer….a lot longer. What can be going on here, why does a simple WriteLine() take so long?

So how many CLR function calls do you think are getting executed for that simple line? 4, 30, 200 – all of these guesses by my colleagues (well the 4 was from somebody who likes Unix too much ;)). No the 64 bit CLR performs around 1050 CLR function calls to do the first WriteLine() and around 80 CLR function calls thereafter.

It’s amazing – and that is only the CLR function calls who know how much native stuff is going on under the surface.

Modern computers are amazing that this can all happen in the blink of an eye and I only notice the complexity if I go looking for it.

Oh and the answer to the original question…0x0000000000000001 of course.