acm-header
Sign In

Communications of the ACM

Kode Vicious

What Are You Trying to Pull?


What Are You Trying to Pull? illustrative photo

Credit: Everett Collection / Shutterstock

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


 

No entries found

Log in to Read the Full Article

Sign In

Sign in using your ACM Web Account username and password to access premium content if you are an ACM member, Communications subscriber or Digital Library subscriber.

Need Access?

Please select one of the options below for access to premium content and features.

Create a Web Account

If you are already an ACM member, Communications subscriber, or Digital Library subscriber, please set up a web account to access premium content on this site.

Join the ACM

Become a member to take full advantage of ACM's outstanding computing information resources, networking opportunities, and other benefits.
  

Subscribe to Communications of the ACM Magazine

Get full access to 50+ years of CACM content and receive the print version of the magazine monthly.

Purchase the Article

Non-members can purchase this article or a copy of the magazine in which it appears.
Sign In for Full Access
» Forgot Password? » Create an ACM Web Account