I’m not stringing you along, honest

JScript and VBScript are often used to build large strings full of formatted text, particularly in ASP. Unfortunately, naïve string concatenations are a major source of performance problems.   Before I go on, I want to note that it may seem like I am contradicting my earlier post, by advocating some “tips and tricks” to…


How Bad Is Good Enough?

I keep talking about script performance without ever actually giving my rant about why most of the questions I get about performance are pointless at best, and usually downright harmful.   Let me give you an example of the kind of question I’ve gotten dozens of times over the last seven years.  Here’s one from…


Long jumps considered way more harmful than exceptions

Bob Congdon’s blog (http://www.bobcongdon.net/blog/) points out that in the dark days before exception handling you could always use setjmp/longjmp to do non-local gotos.   In fact, the script engines are compiled in C++ with exception handling turned off (for performance reasons), and the mainline loop of the bytecode interpreter uses setjmp-longjmp exception handling to implement…


Designing JScript .NET

A while back a reader asked for a rundown on some of the design decisions we made when designing JScript .NET.  That’s a huge topic, but fortunately I started writing a book on the subject a few years ago that never found a publisher.  Tell you what — whenever I can’t think of something more…


It Never Leaks But It Pours

One of the easiest bugs to write is the dreaded memory leak.  You allocate some chunk of memory and never release it.  Those of us who grew up writing application software might sometimes have a cavalier attitude towards memory leaks — after all, the memory is going to be reclaimed when the process heap is…


I’m a traveling man, don’t tie me down

While I was waiting for a shuttle the other day (Microsoft has a fleet of shuttle busses that take people all over the campuses) I was thinking about optimization heuristics. Often we want to find an algorithm that determines the best way to do something. For example, the traveling salesman problem: given a set of…


Arrrrr! Cap’n Eric be learnin’ about threadin’ the harrrrd way

Avast ye scurvy dogs, it be National Talk Like A Pirate Day! A scurvy bilge rat commented on the preceding discussion about putting apartment threaded objects in Session scope: back in the era of the NT4 Option Pack I wrote a lot of code that involved stashing Scripting.Dictionary objects in both session and application scope….


Why is it a bad idea to put script objects in Session scope?

Often a web site will have a series of related pages requested one after the other by the same user.  As a convenience for the site developers, the ASP object model provides a Session object to store server-side state for a current user.  It also has a global “Application” object which stores state for an…


How does Active Server Pages use the script engines?

It’s always struck me as a little bit odd that Active Server Pages, a web server, encourages developers to use VBScript and JScript to write server-side scripts.  I mean, the whole point of a web server is that it produces complex strings (web pages are just strings of HTML after all) as blindingly fast as…