Java - Performance Questions; variable names and file name length

前端 未结 2 1365
执念已碎
执念已碎 2021-01-06 10:11

Well just some questions about performance, but i think some of the questions are logical: - If i use variables with short names will be better/faster to process? Example: \

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-06 10:40

    In addition to the excellent answer by Tomasz, you display all the signs of early optimisation. There's several issues:

    1) Until you hit a problem you don't know what to optimise for: reducing CPU usage is a different optimisation from reducing memory or reducing disk usage

    2) Optimisation costs time, which is either your personal time (which has value) or your company's time (which has a more easily equatable value). Optimisation where it is not necessary is a waste of money.

    3) Reducing variable length (even if it did make a difference) would be irrelevant if the important thing to optimise is 'time spent by a programmer to work out what the software does'. Readable code is important - good variable names are an important part of that.

提交回复
热议问题