L
15

Kept seeing junior devs at my company in Chicago use too many nested loops in Python.

I noticed it last sprint when a pull request for a simple data filter took 45 seconds to run instead of 2, so has anyone else found a good way to point this out without sounding like a jerk?
2 comments

Log in to join the discussion

Log In
2 Comments
thea_knight
45 seconds for a simple data filter? That's insane. I would have lost my mind if I saw that in a PR. We had a similar mess last month with a junior's code that took 30 seconds just to loop through a few hundred records. I finally just showed them my version with a list comprehension and said "this does the same thing in 2 seconds." They got the hint pretty quick.
3
evan_anderson
Are we really gonna act like 45 seconds is that big a deal? I mean yeah it's slow but unless this filter is getting hammered by users constantly, waiting a minute for one report isn't the end of the world. @thea_knight your fix sounds clean and all, but sometimes a junior just needs time to figure stuff out on their own. I've seen way worse, like a coworker who used a nested loop to sort 500 items and it took over a minute, but we just laughed about it and moved on. Not everything has to be optimized to death on day one.
2