After 4 years, I’ve upgraded from my late 2006 15″ MacBook Pro to the very latest model. Overall I’m very happy with the upgrade, and the new laptop has many improvements compared to my old one: unibody case, bigger trackpad, much larger hard-drive, more RAM, bright screen, longer battery life, etc.
One thing that’s slightly disappointing, however, is the performance: across a range of tests, the new machine runs at ‘only’ 2x the speed of my old one. (I say ‘only’ 2x because in nearly any field other than computing, doubling performance in four years would be unimaginable! Imagine Usain Bolt doubling his speed over 100m by the next Olympics).
Here are the specs of the two machines.
Old: MB Pro 15″, 2.0 GHz Core Duo, 1 GB RAM (upgraded to 2GB), 100 GB HD (upgraded to 320 GB), ATI Mobility Radion X1600 with 256 MB VRAM.
New: MB Pro 15″, 2.66 GHz Intel Core i7, 4 GB RAM, 500 GB HD, NVIDIA GeForce GT 300M with 512 MB VRAM.
To get up and running on the new laptop as quickly as possible, I made a clone of the old laptop’s internal drive using Carbon Copy Cloner, booted the new laptop from the clone, and copied it to the internal drive of the new laptop.
Thanks to the clone, the OS, apps, and data on the two laptops were identical, so it was a great opportunity to do some quick performance tests. Some of the tests I ran:
- Full build of a large FlexBuilder workspace
- ActionScript linked list speed test from my previous post
- Timing test for a C++ FFT
In every case, on the new laptop the test ran in almost exactly half the time it took to run on the old laptop. Nice improvement for sure, but certainly not a game changer.
Fact is, mainstream computers aren’t getting that much faster. Long gone are the days when you could write inefficient code, on the assumption that faster, soon-to-be-shipped hardware would make up for it. (In fact, with the surge in mobile devices, I wouldn’t be surprised if the raw computing power of the average consumer computing device has gone down in recent years).
So what to do? There’s no magic bullet, but plenty to try in the software engineer’s bag of tricks. Measure your performance, and determine exactly where the bottlenecks are. Look for better algorithms. Avoid creating & releasing objects unnecessarily. Reduce the number of function calls (if function calls are expensive in your programming language). Cache results of expensive computations. Write time critical bits of code in a more efficient language. Exploit parallelism if you can. Offload some processing to the GPU. And dozens of other possibilities… If all else fails, and some operation absolutely must be slow, make sure the GUI lets users know they need to wait 🙂
One thing to not do is to blindly assume that one approach is the best. There are always trade-offs. For example, it might seem like a no-brainer to write a time-critical bit of code in another language if it gives you a huge performance boost… but then to build, debug, and maintain the code your dev team needs to be proficient in two languages, you need to get licenses for more dev tools, your build process becomes more complicated, etc.
What’s the best solution? It depends…