You are in: RPG Cafe > Performance tip
Short URL: https://ibm.biz/rpgcafe_perf_tip
RPG Cafe: Performance tip
Here is the tip: Beware of performance tips
For me, the performance rule that never changes is this one: Always question any rule you hear about X performing badly, or Y performing better than Z.
- Was it ever true?
- Is it still true?
- Might it change in the future?
- Can I measure the difference?
- Does it apply to my current situation?
- Does the difference matter enough to code in a more complex or error-prone way?
The trouble with performance rules is that even when they are valid rules, people tend to remember them too long. This can cause people to cling to what has become a poorer-performing way of coding, or cause them to code in unnecessarily awkward ways.
Here are some commonly held "rules" to question
- SETLL + READ performs better than CHAIN
- SQL is slower than RPG
- SQL is faster than RPG
- Using VARLEN fields in database slows down the file
- Subroutine calls are faster than subprocedure calls
- Packed variables perform better when they have an odd number of digits
- Flying is faster than taking a train
16 December 2019