Curiosity is bliss    Archive    Feed    About    Search

Julien Couvreur's programming blog and more

Tail calls in .NET


Via Cook, an interesting post on tail calls in .NET and their performance.

The performance of tail "optimized" calls (with the .tail opcode) appears to be less than that of regular function calls. Too bad for recursive code style. The JIT team is working on it.

Also, as my experiments confirmed, the C# compiler doesn't optimize tail calls. Which may be a good thing regarding the performance issue, but discourages recursive coding even more (as you can now blow the stack).

A good explanation on tail call, on Squawks of the Parrot: What the heck is: A tail call.

comments powered by Disqus