Home → Magazine Archive → June 2016 (Vol. 59, No. 6) → What Are You Trying to Pull? → Abstract

What Are You Trying to Pull?

By George V. Neville-Neil

Communications of the ACM, Vol. 59 No. 6, Pages 26-27
10.1145/2909881

[article image]


back to top  Dear KV,

I have been reading some pull requests from a developer who has recently been working in code that I also have to look at from time to time. The code he has been submitting is full of strange changes he claims are optimizations. Instead of simply returning a value such as 1, 0, or -1 for error conditions, he allocates a variable and then increments or decrements it, and then jumps to the return statement. I have not bothered to check whether or not this would save instructions, because I know from benchmarking the code those instructions are not where the majority of the function spends its time. He has argued any instruction we do not execute saves us time, and my point is his code is confusing and difficult to read. If he could show a 5% or 10% increase in speed, it might be worth considering, but he has not been able to show that in any type of test. I have blocked several of his commits, but I would prefer to have a usable argument against this type of optimization.

Pull the Other One

0 Comments

No entries found