5 ms·
Let's say your program takes 100 seconds, of which 99% is spent in f(). Then if you optimize f() such that only 98% of the total time spent in f, then: ori
by nightcracker 11y ago
Let's say your program takes 100 seconds, of which 99% is spent in f(). Then if you optimize f() such that only 98% of the total time spent in f, then:
orig_time = 100
orig_not_f = 0.01 * orig_time = 1
new_f = 0.98 * new_total
new_total = new_f + orig_not_f
new_total = 0.98 * new_total + orig_not_f
new_total - 0.98 * new_total = orig_not_f
0.02 * new_total = 1
new_total = 1 / 0.02 = 50