[cfe-dev] Proposed C++ optimization with big speed gains with big objects

Ladislav Nevery neuralll at gmail.com
Wed Sep 26 16:24:52 PDT 2012


Skyscrapper city[1000]; 
city[1] = Skyscrapper("Empire State Building"); 


              city[1].~Skyscraper(); // release member resources aquired by
default constructor 
try new (&city[1]) Skyscraper("empire state building"); catch(...) { //
cleanup 
     new (&city[1]) Skyscraper()  // reaquire member resources aquired by
default constructor 
     throw; 
} 

this will make code behave like in standard. ie 
in exception handler you get object in state after default initialization
yet preventing default copy happening even when things are fine. 
Optimization will skip the objects calling anything except memset from
default constructor to solve reinvocation state machine change. 



--
View this message in context: http://clang-developers.42468.n3.nabble.com/Proposed-C-optimization-with-big-speed-gains-with-big-objects-tp4026886p4026972.html
Sent from the Clang Developers mailing list archive at Nabble.com.



More information about the cfe-dev mailing list