failing like never before

24Jul/080

Lightbox Effects

So unless you've spent the last few years never clicking on an image on a web page, you're quite familiar with Lightbox-like effects (and if not with the name then at least with the effect itself). Here's an example of Lightbox2 for those unfamiliar with it.

When I say "Lightbox-like," I am referring to any kind of "effect" that allows for embedded pop-ups of images and other forms of media (i.e. flash videos, etc). The benefit of Lightbox, aside from the aesthetics, is that it doesn't result in an actual pop-up (which are often blocked by a pop-up blocker on a modern browser), or require the user to navigate to another page and then hit the browser's "back" button to navigate back to the main content. The basic idea is that Lightbox makes a visitor's life easier, supposedly.

I have two problems with Lightbox-like effects. Firstly, the Javascript files required for the effects tend to fatties. The Lightbox2 Javascript files take up 18Kb, but Lightbox2 also requires the Prototype and Scriptaculous libraries which take up 172Kb. Its not a big deal if you're site is already heavily AJAX-ified and already uses Prototype and Scriptaculous, but not everyone's site does. Quite frankly, I find it to be highly annoying that I spend so much time slimming down my images and making sure that people without lightening fast Internet connections can easily access my sites, only to have Lightbox, which is supposed to improve the visitor's experience, bog my site down by requiring 190Kb of Javascript files. There are of course, many alternatives to Lokesh Dhakar's original Lightbox and Lightbox2, many of them which are much lighter in memory. I stumbled across this helpful "Lightbox Clones Matrix" a month or so back, and it usefully lists memory sizes for each "Lightbox clone."

2Jul/080

Javascript Performance

I've noticed that Javascript runs amazingly slowly in Firefox 3 on my computer. I'm running Debian Lenny with an i686 kernel and I have the i686 version of FF3 downloaded straight from the firefox website. Under Opera, Konqueror, and Epiphany, on my computer, Javascript effects like Lokesh Dhakar's Lightbox, (which I'm using on my blog to display image) tend to be a little sluggish, but in Firefox 3, performance is horrendous. In Lightbox, when you click an image the entire page darkens, which normally takes next to no time, even on my Mom's old Celeron loaded down with tons of malware. But in FF3 on my computer, it takes a noticeable amount of time for Lightbox to darken the screen, at least a second or two. I tried running other Javascript intensive websites, built with various libraries including JQuery, Prototype, and Mootools, but the results were the same. Javascript performance continued to be absymal. Indeed, in some cases I clicked an image, went to the bathroom, came back and found my computer was still trying the zoom the image out.

I haven't conducted any kind of indepth, exhaustive testing of FF3's Javascript performance, but from cursory usage, I have determined that its pretty bad. Aside from complaining, I have no idea what else to do.