Can using non primitive Integer/ Long datatypes too frequently in the application, hurt the performance?

前端 未结 4 1712
孤街浪徒
孤街浪徒 2021-01-20 11:02

I am using Long/Integer data types very frequently in my application, to build Generic datatypes. I fear that using these wrapper objects instead o

4条回答
  •  無奈伤痛
    2021-01-20 11:39

    Like others say,

    Premature optimization is root of evil.

    Having said that, prefer primitive types to boxed types wherever you can.

    UPDATE: Might also add that according to developers that work with high-performing code (like distributed cache) boxing can indeed become a performance problem quite frequently. I also worked with high-performing apps. but have never identified boxing as a worthy optimization place yet.

提交回复
热议问题