How to work with people who stonewall a discussion the minute it has to do with performance?
How to work with people who stonewall a discussion the minute it has to do with performance?
Begin with shared principles that build on the strategic direction of your group.
My Principles:
My personal principles on writing code are to first aim for correctness in my program, then to profile it and determine if it needs optimization. I profile my code myself because other programmers are potential consumers of my code - and they will not use it if it is slow - thus for my code, speed is a feature.
If your consumers are customers, your customers will tell you if you need faster code.
However, there are known, demonstrably better choices in code that one can make. I would rather get it right in in my first draft for several reasons:
- If I get it right the first time, then I can forget about the implementation (taking advantage of information hiding), and I don't clutter up my code with TODOs.
- Others (particularly those who only learn on the job) see it done the right way, and they learn from and use the same style of code going forward. Conversely, if they see me do it the wrong way, they'll do it the wrong way too.
Assuming the need for optimization is correct
Assuming this is a truly important part of your code that needs optimization, you could tell the parable of Schlemiel the Painter, or emphasize the remainder of the quote:
"Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%." - Donald Knuth
Weigh the costs of additional complexity
Sometimes there's a real cost in terms of the maintainability of the added complexity. In this case, you might keep the secondary implementation in a different function or subclass, and apply the same unittests to it so that there is no question that it is correct. Later, if you profile your code and find the naïve implementation to be a bottleneck, you can switch in your optimized code and demonstrably improve your program.
Leadership
Sometimes the problem is ego - some people would rather use suboptimal or buggy code than have someone else be more right than they are. You probably want to avoid working with these people.
Leadership, especially when you do not have positional authority over people, is about making reasonable suggestions and guiding others to a consensus. If you can't guide your team to a meeting of the minds, perhaps the matter is not worth pressing. There's probably bigger fish to fry.