Transcription of Tips for Optimizing C/C++ Code - Clemson University
{{id}} {{{paragraph}}}
tips for Optimizing C/C++ Ahmdal s Law:Speedup=timeoldtimenew=1(1 funccost)+funccost/funcspeedup Wheref unccostis the percentage of the program runtime used by the functionf unc, andf uncspeedupisthe factor by which you speedup the function. Thus, if you optimize the functionT riangleIntersect(), which is 40% of the runtime, so that it runstwice as fast, your program will run 25% faster (1(1 )+ ). This means infrequently used code ( , the scene loader) probably should be optimized little (if at all).
• Make sure all data structures are aligned to cache line boundaries. (If both your data structure and a cache line is 128 bytes, you will still have poor performance if 1 byte of your structure is …
Domain:
Source:
Link to this page:
Please notify us if you found a problem with this document:
{{id}} {{{paragraph}}}