I’ve introduced a new method for loading SyntaxHighlighter onto a web page. The goal was simply to make it easier to integrate SyntaxHighlighter into a web site. So, I was pleasantly surprised to find that the new method often loads faster than the traditional method.
I’ve updated this site’s fork of the SyntaxHighlighter software by Alex Gorbatchev. These features a partial merge from Alex’s 2.1.364 release. I’ve also added a “Hide” button to the toolbar.
I’ve just gone live with a different WordPress theme. So, if you’re feeling a bit lost, don’t panic. This is a new theme, iTech, which was just released last month. I’ve tailored the CSS, fixed a bug or two in the php, and even managed to add a new customization option. It’s been a good [...]
Arrays can present an unexpected performance bottleneck in JavaScript. Here I show that array performance is influenced by some surprising details of the array and how it’s used.
The JavaScript interpreters in the most popular browsers distinguish between sparse and dense arrays. Hence, you may get more “array-like” performance if you initialize an array before using it. But this trades memory for speed, so it may not always be the best choice.
It may well be that for better JavaScript performance, large arrays should be avoided where possible. That seems fairly clear in this case, where an already fast implementation of the missing String.trim() method was made even faster by using much smaller lookup table arrays.
July 22 2009 by
Dan Breslau in
Web |
Sometimes the best way to solve a problem is to make it no longer be a problem. This was the case with a problem that I’d created — and have now fixed — in my version of SyntaxHighlighter.
SyntaxHighlighter now preserves whitespace. Kind of. It’s not pure WYSIWYG, but it’s YCAGWYWBIYTSYJMFYGWYN. It’s good enough that we can stop using Flash to access the clipboard.
In software engineering, Occam’s Razor has a corollary: When entities are multiplying, find out how they became necessary. An issue in SyntaxHighlighter illustrates this principle.
In my latest round of updates to SyntaxHighlighter, I’ve removed the dependencies on jQuery that I’d added in previous updates. There are some small improvements, too.