We are under pressure to implement a software project before a deadline and have the software run as fast as possible by then. A minor optimization would be the use of a different data structure. My supervisor implemented this data structure several years ago. He now gave me his implementation and told me to use it, he expected it to be a very minor change.

However, I noticed a possible memory corruption in his implementation, requiring an (almost) complete rewrite to be usable. This would be a bad use of my time given the deadline pressure. Should I tell him, rewrite the code myself, or simply not do it and only mention it when asked?

Update: I wrote a quick test case. It didn't show the memory corruption I expected, but showed that the performance improvement was not as big as hoped and that side effects occur which impact the solution quality. We talked about the results and agreed not to use the new data structure.

closed as off-topic by IDrinkandIKnowThings, gnat, Masked Man, Thalantas, The Wandering Dev Manager Feb 7 '17 at 19:13

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking for advice on what to do are not practical answerable questions (e.g. "what job should I take?", or "what skills should I learn?"). Questions should get answers explaining why and how to make a decision, not advice on what to do. For more information, click here." – IDrinkandIKnowThings, gnat, Masked Man, Thalantas, The Wandering Dev Manager
If this question can be reworded to fit the rules in the help center, please edit the question.

  • possible? worth the risk. prove it. – Stephan Bijzitter Feb 7 '17 at 14:55
  • 1
    It is using stored iterators after operations that invalidate them, this is a segfault waiting to happen. I could implement a test case, though. – Anonymous Sockpuppet Feb 7 '17 at 14:59
  • 2
    The workplace is not a place questions that ask us to make a decision for you belong. – IDrinkandIKnowThings Feb 7 '17 at 15:46
  • Are you sure he expected you to use it as-is? Or is it possible he was giving it to you in the same context as someone might give an answer on StackOverflow; i.e. "here's a quick dirty attempt I've made at it to give you an idea of the kind of approach I think might work. You go and tinker with it." – Jonathon Cowley-Thom Feb 9 '17 at 10:57
  • @JonathonCowley-Thom Yes, he explicitly said that using it would be "ten lines of code". However, a first test case showed that it didn't bring the hoped performance improvement anyway. – Anonymous Sockpuppet Feb 9 '17 at 14:29

Ignoring someone unless asked is a surefire way to make people annoyed (or worse) at you.

So you need to do something. In this case it seems a pretty clear case of "wrong expectations". Your supervisor thinks that A) his code works and B) integrating it will be easy.

You have now learned that both of these expectations are incorrect. The only way to find out what to do next, is to talk to your supervisor about these findings, allow him to adjust his expectations and then determine what to do next from there. (Either together or based on his decision, I don't know how the relationships for your project are)

If it's possible for you to build a test-case so you can prove to yourself and your supervisor that this code really is broken and it won't take too long, that would be valuable as proof is stronger than belief.

In general, when working on something as a team, keep everyone informed and expectations aligned and you'll have the least issues and the smoothest course.

  • 1
    It's generally a good idea to hold off on accepting answers, as questions with an accepted answer are less likely to attract more (possibly contradicting) answers :) – Erik Feb 7 '17 at 15:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.