There was a thread recently on the CFGURU mailing list about the merits of the various tweaks that CFML developers use to gain a few extra milliseconds. The consensus was that most performance problems won't be solved by using these tweaks, they typically lay within the database, application architecture, and lack of caching. Here are some tips:
- The tweaks often distract developer from the true bottle neck
- Often times these tweaks are discovered by timing loops, when load testing the differences are often negligible.
- Different versions of CF may alter the effectiveness of the tweak
- If you have found, and fixed all your bottlenecks, implemented caching, and have nothing better to do - then it may be a good time to start evaluating some of these coding tweaks. I say - have nothing better to do because the price of hardware is much cheaper than the cost of developing and testing.
- The JVM may end up optimizing for you - A technology called hotspot which exists inside the java virtual machine that will automatically perform byte code optimizations for you at run time based on the frequency of code execution. So when your doing a loop test you almost always going to invoke the hotspot compiler, and you are really just testing which code the hotspot can optimize better - but in the real world execution the function call may never end up in the hotspot.
This is all not to say that there are no best practices, there are - you need to evaluate the best practices to see if they make sense.
You should ask yourself before you do anything performance related if it improves your code quality; the readability, maintainability, and performance. If it does then it is a good practice.
Additionally the relative low cost of hardware issue is often an excuse for writing poor performing code. I'm not trying to advocate that you don't pay attention to performance, just that you should be focused when you tune your app. The 80/20 rule states that 80% of the execution time takes place in 20% of your code.
- Google Video: MySQL Performance Tuning Best Practices - May 11, 2006
- OutOfMemoryError - GC overhead limit exceeded - March 25, 2010
- MySQL Optimization Hints - January 2, 2007
- Premature optimization is the root of all evil - December 8, 2005
- Java Performance Tuning Guide - December 7, 2005
- ColdFusion returning empty response with server-error: true
- Careful applying CF11u16, CF2016u8, CF2018u2
- Sessions don't work in Chrome but do in IE
- csrfVerifyToken does not invalidate the token
- The cf_sql_ is optional in cfqueryparam
- Cookie Expires / Max-Age 1969-12-31T23:59:59.000Z
- Burst Throttling on AWS API Gateway Explained
- How to Resolve Java HTTPS Exceptions