|Just another Perl shrine|
Re: Is Performance Overrated?by Codon (Friar)
|on Feb 13, 2006 at 20:58 UTC||Need Help??|
There absolutely are times when performance can be a "make or break" metric. You state that you have been "scripting" for 10 years. This is a generalization, I know, but scripting usually means throwing together some tools to make life easier when it comes to repetitive tasks, maybe automating some daily procedures, etc. In these cases, the difference between the job finishing in 0.025 seconds and 0.5 seconds won't make a difference. Here, performance doesn't matter.
On the other hand, in application programming, performance can be the difference between a snappy, responsive system and one that is laggy and sluggish. Imagine a fighting game that took 1 second to translate your inputs into motions on the screen. You would have to predict what the enemy was about to do in order to react before they act.
For a non-game application example of when performance matters (to some), I just finished working on a complete re-write of our data access layer. It has to handle a total volume of 240 requests per second. It was built with the ability to scale with more hardware, but the hardware order was based on very early performance numbers. Later performance tests showed that we would not have enough hardware to support the volume of traffic and we did not have enough time to order more hardware.
After profiling the system, we were able to squeeze out more than 30% speed improvement by tweaking three subroutines. We swapped out Storable::dclone in favor of Clone::clone (which then proved to leak memory like a sieve) and got an easy 10%. Next, we optimized our sort algorithm and picked up about another 10%. Finally, we minutely tweaked a data accessor, speeding it up by about 0.01%. However, since we used strong data encapsulation throughout the system and this data accessor was used for every attribute of every class, this 0.01% in a single method resulted in an overall 10% gain in the system performance.
When all was said and done, we had brought the system well within the range of performance that we needed in order to launch and service the level of traffic we expected.
So, in short, there are times when performance can matter a lot. And trying to eek out that last little drop of performance can result in a massive win for you application. Without that little tweak, you cannot launch because your site could crash under the load; with it, you can launch and continue to grow.
Sr. Software Engineer, DAS Lead