id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 2563,[boost][serialization] void_upcast is very slow,jacobholm@…,Robert Ramey,"My preference would be to detect mulitple inheritance at compile time if that's possible. Make a TRAK ticket for this item. Robert Ramey '''''Jacob wrote:''' The original ""inline void_upcast"" method checks if the pointer to the object is of the right type, by traversing its parents. This is necessary when using multiple inheritance, since in such a case the adress of the pointer to the object can vary depending on which base class it is cast to.'' ''While profiling one of my projects I noticed that most of the time was spent in the void_upcast method. I modified the method to return the pointer directly(see below), resulting in a high performance increase. This ""solution"" is possible if you avoid multiple inheritance all together, which I did. In my particular project I experienced a 75% speed increase implementing this, going from about 10 seconds to 2.5 seconds.'' ''Would it be possible to implement some functionality to turn on and off the upcasting for given classes, kind of like the tracking of objects is currently administrated?'' ''Modified ""inline void_upcast"":'' {{{ /inline void * void_upcast( extended_type_info const & derived, extended_type_info const & base, void * const t ){ return const_cast(t); }/ }}} ''Yours sincerely,'' ''Jacob Holm''",Feature Requests,closed,Boost 1.38.0,serialization,Boost 1.37.0,Optimization,invalid,,