Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Performance of Object Typecasting

How costly is Object Typecasting in terms of performance?
Should I try to avoid Typecasting when possible?

like image 802
Acidic Avatar asked Jan 10 '12 12:01

Acidic


1 Answers

It is cheap enough that it falls into the category of premature optimization. Don't waste time even thinking or asking questions about it unless you have profiled your application and determined that it's a problem, and most importantly: don't compromise your design to avoid it.

like image 65
Michael Borgwardt Avatar answered Oct 01 '22 06:10

Michael Borgwardt