programming in the
twenty-first century

It's not about technology for its own sake. It's about being able to implement your ideas.

Slow Languages Battle Across Time

In my previous optimistic outburst I asserted that "Even a language like Ruby, which tends to hang near the bottom of any performance-oriented benchmark, is thousands of times faster than BASICs that people were learning to program 8-bit home computers with in the 1980s." That was based on some timings I did five years ago, so I decided to revisit them.

The benchmark I used is the old and not-very-good-as-a-benchmark Sieve of Eratosthenes, because that's the only benchmark that I have numbers for in Atari BASIC on original 8-bit computer hardware. Rather than using Ruby as the modern-day language, I'm using Python, simply because I already have it installed. It's a fair swap, as Python doesn't have a reputation for performance either.

The sieve in Atari BASIC, using timings from an article written in 1984 by Brian Moriarty, clocks in at:

324 seconds (or just under 5 and a half minutes)

The Python version, running on hardware that's a generation back--no i7 processor or anything like that--completes in:

3 seconds

Now that's impressive! A straight-ahead interpreted language, one with garbage collection and dynamic typing and memory allocation all over the place, and it's still two orders of magnitude, 108 times, faster than what hobbyist programmers had to work with twenty-five years ago. But what about the "thousands of times" figure I tossed about in the first paragraph?

Oh, yes, I forgot to mention that the Python code is running the full Sieve algorithm one thousand times.

If the Atari BASIC program ran a thousand times, it would finish after 324,000 seconds or 5400 minutes or almost four days. That means the Python version is--get ready for this--108,000 times faster than the Atari BASIC code.

That's progress.

(If you liked this, you might also like A Spellchecker Used to be a Major Feat of Software Engineering.)

permalink November 14, 2009

previously

archives

twitter / mail

I'm James Hague, a recovering programmer who has been designing video games since the 1980s. Programming Without Being Obsessed With Programming and Organizational Skills Beat Algorithmic Wizardry are good starting points. For the older stuff, try the 2012 Retrospective.

Where are the comments?