[cfe-dev] Proposed C++ optimization with big speed gains with big objects
neuralll at gmail.com
Tue Sep 25 09:26:03 PDT 2012
The moment I agreed to assign new value I agreed to old value being lost.
This is normal and expected behavior.
If you wana preserve old value for whatever reason (construction failure)
you keep old value in temp like you do for everything else.
Advantage is you know what is going on.
You know that redundant copy is being kept and you can use it as you wish;
But it's big performance difference of preserving state of objects we 99% of
time don't care about in this particular case.
Skyscrapper city, tmp=city; // 1000 in this case useless default
constructors doing nothing more that specialized one does not do too
city=Skyscrapper("Empire"); //exception occurs so we just try again or
restore to tmp in usual exception handler
in this case which is prety much most of the static array creation loops
restoring to tmp doesn't make sense so thank god we can skip it and ged rid
of useless copy
View this message in context: http://clang-developers.42468.n3.nabble.com/Proposed-C-optimization-with-big-speed-gains-with-big-objects-tp4026886p4026923.html
Sent from the Clang Developers mailing list archive at Nabble.com.
More information about the cfe-dev