Readability vs Performance

后端 未结 3 1691

Recently we had a discussion at work about the impact of local variables on the performance vs readability of Java code. Some of my colleagues are of the oppinion that declarati

3条回答
  •  情深已故
    2021-02-13 02:38

    A person's time is millions of times more expensive than a computer's time.

    If the line of code is expected to execute millions of times more than it will be looked at by a programmer then perhaps you should consider optimising. But certainly not until then.

    Even then, it is completely pointless to optimise as if the compiler is stupid.

    Don't forget! Premature optimization is the root of all evil.

提交回复
热议问题