It's a bad idea to optimize prematurely.
about the word why it chooses to use the word prematurely here. it's a sentence from puzzle 1 of the book <<java puzzlers>>, i can't see why he uses prematurely here instead of immaturely etc.
------解决方案--------------------
意思大致一样,但是适合的语境却不一样
话说,这里可以用汉语回复吗?
------解决方案--------------------
take the following as an example, how do you think about this?
if we are developing an program which consists of three functions, funcA,funcB and main(the caller of funcA and funcB). now we split this program into two stages.
stage 1:finish funcA and funcB;
stage 2:finish main.
when stage 1 is finished, a test report indicates that it takes 500ms to run funcA and 50ms to run funcB. it seems that funcA takes too much time, right? if we start optimizing right now, possibly we will take much effort to optimize funcA, even it is hard to be optimized. but what if the main is like this?
int main(...)
{
int i=100000;
funcA();
while(i--)
funcB();
return 0;
}
according to the main function, it is more necessary to optimize funcB.
------解决方案--------------------
------解决方案--------------------