(picture)

June 16, 2003

More Performant

In my recent JavaScript performance epiphany, I realized just how bad JScript performance can be. I thought I had two options: choose a better language, or resign myself to being a couple of years behind the Moore's Law curve.

There's a third way, and it's interesting enough to tell. .NET. Watch out: I think I just took the red pill.

Thus far, I've managed to avoid the wonders of .NET; I did install the runtime, and even the IDE, but never worked with it in earnest.

The .NET framework includes "JScript.NET": a (fairly complete) implementation of ECMAScript on the .NET common-language runtime. And if you just install the runtime, you do get the compiler. Still the ugly duckling, but it's way faster than the old cscript/wscript.

My anagrams code now runs in 7 seconds. And the arraytest code stressing "for(key in table)" is very dramatically improved:







RunsArray Sizesum1() mssum2() ms
1000010052987821
1000100080528542
10010000801212427
101000001018515923
110000001174727810
(code)

Maybe this really is the best of all worlds: a dynamic language, compiled, with a rich class library compatible across environments. That class library is the learning curve ahead; now, there's no chasm to cross before I start climbing.