C++: Optimization Techniques
English | 2020 | ASIN: B08KLP3R9Y | 450 Pages | PDF/EPUB/AZW3/MOBi | 7.48 MB
Deciding Whether to Optimize
Suppose you have written a program to calculate mortgage payments; the yearly run takes ten minutes.
Should you spend two hours to double its speed? Probably not, since it will take twenty-four years to
pay back the original investment of time at five minutes per year.2 On the other hand, if you run a
program for three hours every working day, even spending thirty hours to double its speed will pay
for itself in only twenty working days, or about a month. Obviously the latter is a much better
candidate for optimization. Usually, of course, the situation is not nearly so unambiguous: even if your
system is overloaded, it may not be immediately apparent which program is responsible.3 My general
rule is not to optimize a program that performs satisfactorily. If you (or the intended users) don't
become impatient while waiting for it to finish, don't bother. Of course, if you just feel like indulging
in some recreational optimization, that's another matter.
https://mega.nz/file/Z50yVQjL#o5vz4ytrCSYbtUeZ0U2dg5GIUpgr62DZ5mw1KLzb_JU
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!