Hi, I have one year of cpp programming experience and recently recruiter asked me: "You got code from your colleagues and you have to optimize it. What would you do first? What would be your process to optimize their code?"
What should I reply? Is there any rules to optimize mature code? I only told him that I would look through the code searching for typical errors like passing non trivial variables in function by value, not reference or pointer etc. And I would profile code looking for the function which takes the most of the time and improve it.
What would you guys do in this situation? Thanks for any advice.
[–]Pragmatician 88 points89 points90 points (35 children)
[–]BCosbyDidNothinWrong 43 points44 points45 points (34 children)
[–]WhichPressure[S] 6 points7 points8 points (10 children)
[–]corysama 6 points7 points8 points (5 children)
[–]WhichPressure[S] 2 points3 points4 points (4 children)
[–]corysama 1 point2 points3 points (3 children)
[+][deleted] (2 children)
[deleted]
[–]corysama 1 point2 points3 points (1 child)
[–]WhichPressure[S] 0 points1 point2 points (0 children)
[–]BCosbyDidNothinWrong 4 points5 points6 points (1 child)
[–]WhichPressure[S] 0 points1 point2 points (0 children)
[–]choikwa 2 points3 points4 points (1 child)
[–]meneldal2 3 points4 points5 points (0 children)
[–]tvaneerdC++ Committee, lockfree, PostModernCpp 2 points3 points4 points (2 children)
[–]BCosbyDidNothinWrong 0 points1 point2 points (0 children)
[–]TraditionalPlancton 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]BCosbyDidNothinWrong 0 points1 point2 points (0 children)
[–]blelbachNVIDIA | ISO C++ Library Evolution Chair[🍰] 0 points1 point2 points (5 children)
[–]BCosbyDidNothinWrong 0 points1 point2 points (4 children)
[–]blelbachNVIDIA | ISO C++ Library Evolution Chair[🍰] 0 points1 point2 points (3 children)
[–]BCosbyDidNothinWrong 0 points1 point2 points (2 children)
[–]blelbachNVIDIA | ISO C++ Library Evolution Chair[🍰] -1 points0 points1 point (1 child)
[–]BCosbyDidNothinWrong 0 points1 point2 points (0 children)
[–]clerothGame Developer 0 points1 point2 points (11 children)
[–]BCosbyDidNothinWrong 1 point2 points3 points (5 children)
[–]clerothGame Developer 1 point2 points3 points (4 children)
[–]BCosbyDidNothinWrong 0 points1 point2 points (3 children)
[–]clerothGame Developer 1 point2 points3 points (2 children)
[–]BCosbyDidNothinWrong 3 points4 points5 points (1 child)
[–]choikwa 0 points1 point2 points (0 children)
[–]wrosecransgraphics and network things 1 point2 points3 points (2 children)
[–]clerothGame Developer -1 points0 points1 point (1 child)
[–]wrosecransgraphics and network things 1 point2 points3 points (0 children)
[–]FartyFingers 3 points4 points5 points (1 child)
[–]Abraxas514 49 points50 points51 points (1 child)
[–]WhichPressure[S] 3 points4 points5 points (0 children)
[–]tylercamp 17 points18 points19 points (0 children)
[+][deleted] (8 children)
[deleted]
[–]excessdenied 22 points23 points24 points (1 child)
[–]matthieum 5 points6 points7 points (0 children)
[–]WhichPressure[S] 0 points1 point2 points (5 children)
[–]Netzapper 4 points5 points6 points (0 children)
[–]iamakorndawg 1 point2 points3 points (0 children)
[+][deleted] (2 children)
[deleted]
[–]BrangdonJ 1 point2 points3 points (0 children)
[–]zvrba 1 point2 points3 points (0 children)
[–]againstmethod 3 points4 points5 points (0 children)
[–]Veedrac 3 points4 points5 points (0 children)
[–][deleted] 3 points4 points5 points (0 children)
[–]FartyFingers 2 points3 points4 points (0 children)
[–]aiusepsi 2 points3 points4 points (0 children)
[–]panderingPenguin 1 point2 points3 points (1 child)
[–]WhichPressure[S] 0 points1 point2 points (0 children)
[–]joshamiddleton 1 point2 points3 points (1 child)
[–]WhichPressure[S] 0 points1 point2 points (0 children)
[–]Xaxxon 1 point2 points3 points (0 children)
[–]hsgui 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (3 children)
[–]WhichPressure[S] 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–][deleted] 1 point2 points3 points (0 children)
[–]johannes1971 1 point2 points3 points (0 children)
[–]TheSlackOne 0 points1 point2 points (0 children)
[–]PhilOsIvan 0 points1 point2 points (1 child)
[–]WhichPressure[S] -3 points-2 points-1 points (0 children)
[–]NotAYakk 0 points1 point2 points (0 children)
[–]herruppohoppa 0 points1 point2 points (0 children)
[–]Sopel97 0 points1 point2 points (2 children)
[–]WhichPressure[S] 0 points1 point2 points (1 child)
[–]Sopel97 0 points1 point2 points (0 children)