Compiler could elide many more postblit constructor calls

TommiT tommitissari at hotmail.com
Sun Jun 30 03:21:11 PDT 2013


Perhaps an interesting observation about this is that while in 
C++ const correctness literally never improves performance [1], 
in D (if these optimizations were implemented) const correctness 
could potentially increase performance considerably (if there are 
expensive postblits). Thus, functions should take arguments by 
const value rather than value, when the type of the parameter is 
either templated or has postblit.

[1] Except with constant folding or when the compiler can put 
const data to rommable memory and then share it with multiple 
instances of the same program.


More information about the Digitalmars-d mailing list