April 21, 2016
MarkBernstein.org
 
Follow me on Twitter

Performance

Brent Simmons says a bunch of smart things about Performance These Days.

For twenty years, people have been saying that machines are so fast, you hardly ever need to think about speed. Yes, you could write a ton of your code in any slow, interpreted language you name, and nobody would notice. “Making things fast has to do with choosing fast data structures and algorithms,” Brent says, and “moving things off the main thread.” And he is not wrong.

But there’s more to it than that, too.

Nothing will save you from a really bad algorithm, but a fast compiler can often make a naive implementation Fast Enough. Tinderbox used to do horrendously tricky things for caching the screen; now, the framework and the hardware handles all that. Storyspace used to use a ghastly file format that had the sole virtue of being really fast and really compact; now, we use XML – slow and verbose – and everything’s fast anyway.

There’s also a very interesting chasm between things that take about a second and things that take, say, a 60th of a second. A whole second interrupts your work; you don’t like that one bit. 1/60th of a second? Well, that might drop a frame of animation, making your nice animated transactions stutter slightly. If we need to, we can live with that.

I’m currently thinking about a big project for Tinderbox that might be able to do some remarkable things – but those things need to be done during the drag. The difference between 1ms and 10ms in this case is probably the difference between “that’s sort of amazing” and “it didn’t work.” Algorithms matter, but once you’ve got the algorithms down, speed matters too.