November 23, 2006

Muenchian grouping perf in .NET 2.0 (XslCompiledTransform)

Back in 2005 I was writing about speeding up Muenchian grouping in .NET 1.X. I was comparing three variants of the Muenchian grouping (using generate-id(), count() and set:distinct()). The conclusion was that XslTransform class in .NET 1.X really sucks when grouping using generate-id(), performs better with count() and the best with EXSLT set:distinct().

Here is that old graph:

Today a reader reminded me I forgot to post similar results for .NET 2.0 and its new shiny XslCompiledTransform engine. So here it is. I was running simple XSLT stylesheet doing Muenchian grouping. Input documents contain 415, 830, 1660, 3320, 6640, 13280, 26560 and 53120 orders to be grouped.

Besides being pretty damn faster that XslTransform, XslCompiledTransform shows expected results - there is no difference in a way you are doing Muenchian grouping in .NET 2.0 - all three variants I was testing are performing excellent with very very close results. Old XslTransform was full of bad surprises. Just switching to count() instead of generate-id() provided 7x performance boost in grouping. That was bad. Anybody digging into XslTransform sources knows how ridiculously badly generate-id() was implemented. Now XslCompiledTransform shows no surprises - works as expected. No tricks needed. That's a sign of a good quality software.

...

The Old New Thing Book

From TSS.Net I found out that Raymond Chen, the man who can make Win32 programming exciting, published a book "The Old New Thing: Practical Development Throughout the Evolution of Windows". "The Old New Thing" is of course the name of his blog, described as "not actually a .NET blog". The book is to be available December 29. I want this book.

Why does Windows work the way it does? Why is Shut Down on the Start menu? And why is there a Start menu? Many of Windows' quirks have logical causes rooted in history. In The Old New Thing: Practical Development Throughout the Evolution of Windows, Raymond Chen, of Microsoft's Windows development team, reveals the "hidden Windows" developers and users need to understand. Chen helps readers understand Windows with behind-the-scenes explanations, technical information, and anecdotes. Topics include window and dialog management, performance optimization and why it can be so counterintuitive, an under-the-hood look at COM and the Visual C++ compiler, backwards compatibility, and little-known Windows program security holes.

TSS.Net also publishes two chapters:

Chapter One of The Old New Thing, titled "Initial Forays into User Interface Design," describes why Windows is the way it is. Chen answers some of the most frequently asked questions about the user interface, and tells the story and reasoning behind each tough decision and rule that the Windows team had to implement.

Download Chapter One: Initial Forays into User Interface Design

Chapter Three of Chen's book, titled "The Secret Life of GetWindowText," addresses the complexity of GetWindowText, giving the full story behind the documentation. Chen also explains the compromises made around GetWindowText, and ways to escape its rules.

Download Chapter Three: The Secret Life of GetWindowText

Chapter one is particularly cool:

  • Why do you have to click the Start button to shut down?
  • Why doesn’t Windows have an “expert mode”?
  • The default answer to every dialog box is Cancel
  • In order to demonstrate our superior intellect, we will now ask you a question you cannot answer
  • Why doesn’t Setup ask you if you want to keep newer versions of operating system files?
  • User interface design for vending machines
  • User interface design for interior door locks
  • The evolution of mascara in Windows UI
...