Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualOlof Hedman

Posted 28 January 2013 - 09:31 AM

When people say that dynamic cast is slow, they mean that it is slower then doing no work at all, which is the case of a static cast.
With this comparision, its infinitely slower, but that doesn't mean that the dynamic cast will matter in your project.

If you do any reasonable amount of work with the pointer after (doesn't even have to be that much) the cost of the dynamic cast will quickly disappear.
It's not that slow, its just much slower then doing no work :)

That said, dynamic casts are often avoidable, and the need to use them usually points to something fishy in your design.

#1Olof Hedman

Posted 28 January 2013 - 09:29 AM

When people say that dynamic cast is slow, they mean that it is slower then doing no work at all, which is the case of a static cast.

With this comparision, its infinitely slower, but that doesn't mean that the dynamic cast will matter in your project.

 

If you do any reasonable amount of work with the pointer after (doesn't even have to be that much) the cost of the dynamic cast will quickly disappear.

It's not _that_ slow, its just much slower then doing no work :)

 

That said, dynamic casts are often avoidable, and the need to use them usually points to something fishy in your design.


PARTNERS