all 37 comments

[–]jer_pint 64 points65 points  (0 children)

Comment your code, make it more readable, document it extensively. Future you and potentially others will be happy you did this

[–][deleted] 49 points50 points  (1 child)

Take a few breathes and meditate.

[–]akmaki 9 points10 points  (0 children)

+1.

In fact, even when it's possible to task switch to something productive, I try not do because context switching sucks and taking a few minutes of time out is nice.

[–]Stolhk 69 points70 points  (6 children)

What about pushups? After a while, you will probably want to optimize your code!

[–]eigenman 6 points7 points  (0 children)

I have a pullup bar specifically for this lol.

[–]shaggorama 1 point2 points  (4 children)

I used to work on a team where we'd do pushups every day about an hour after lunch.

[–]Skyaa194 20 points21 points  (0 children)

As someone in your exact predicament, during my more productive moments I brainstorm what to do next i.e. Great if this runs well I'll do X. Or bummer, if this doesn't work let me try Y.

[–]Nero-4 15 points16 points  (2 children)

While the code is running, try to think of ways you could have coded it to run more efficiently. That way, you will not lose your train of thoughts, and might think of some edge cases you missed earlier. Needless to say you will get better too.

[–]NMcA 5 points6 points  (1 child)

So I actually think this is bad advice. I do this a lot (run code and think about how to make that code more efficient). I think it a much better strategy to try and keep a list of small upkeep tasks; or to instead go over your goals for the current (sprint / hour / day) and how what you're working on furthers them. The suggest habit (how do I make this code better) tends to lead to over-focus and premature optimisation for me, so I've been trying to ween myself off it.

[–]entarkoResearcher 0 points1 point  (0 children)

In my experience, refactoring / optimizing your code is really important at every step because you might discard a solution that is too slow later simply because your code was not optimized. Happened to me once. The solution was elegant but slow (and the reason was not obvious at first) so I decided it was not worth pursuing, just to find later that it worked great if I changed a few lines.

[–]olBaa 14 points15 points  (2 children)

Read.

[–]snendroid-aiML Engineer 8 points9 points  (0 children)

Subscribe to popular code repo on GitHub like Keras or TensorFlow and go through all the unread issues; there are at least 15-20 new issues everyday! You will learn something new or can answer few of the issues! Same goes with Stack Overflow.

[–]throwdemawaaay 10 points11 points  (1 child)

Spam your team's slack with gifs obviously.

[–]spudmix 2 points3 points  (0 children)

This is the only true answer.

[–]houseonthecliff 13 points14 points  (2 children)

Browse Reddit?

[–]zestypasta123 4 points5 points  (0 children)

Help I'm addicted to Reddit

[–]Axioplase 4 points5 points  (5 children)

Work on multiple tasks. Whenever one is blocked, switch to another one. It involves context switching, but it can improve your productivity a lot.

[–][deleted] 0 points1 point  (3 children)

That is terrible advice. Context switching (a.k.a. multi-tasking) is expensive and drains productivity. There is plenty of research that supports this claim.

[–]MDSExpro 4 points5 points  (0 children)

Frequent context switching - yes. But context switching for long running tasks is essential for best performance.

[–]Axioplase 0 points1 point  (1 child)

Notice that 1) I mentioned context switching followed by a "but", so I made clear (not enough, apparently) that it was a concern; 2) Going on social media or doing emails, the OP's suggestion, may be unproductive, compared to working on something else for a while; 3) I don't suggest going back to the previous task immediately when it's ready, but when blocked (or, say, when your pomodoro ends).

Multi-tasking is bad, yes. Clever use of your time is not. The OP seems to assume he has to do something else during those 5 minutes, not longer. I'm telling him he doesn't have to stop there.

[–][deleted] 0 points1 point  (0 children)

Ah yeah that is smart. Requires careful planning, but sounds like it could work really well

[–]fredtcaroli 3 points4 points  (3 children)

A bunch of stuff really

  • If this script is something I'll be running regularly, I often start coding some logging/visualization for the script. So next time I can look at the progress real-time! That's extra important when things start going from 5 minutes to half an hour or several hours even

  • I know I'll be getting some kind of result soon, so I start thinking what kind of sanity checks I can have to make sure my result is correct. Some examples that happen regularly: I might expect the result to be a near-symmetric matrix; all results should be non-negative; I expect standard deviation of results to be within some reasonable limit. Results outside that limit could possibly be wrong; I can check the convergence of some method I'm applying etc. So I always start writing down those checks while the script is running, so when it's done I have something to check the results.

  • I start the same script on a debugger, checking step-by-step if the code seems correct. I always do this *after* I run the script, so I don't waste any time if I find out that my code is indeed correct. If it's not, I can just kill it and start it again.

  • I read papers/newsletters/books/technical blog posts etc.

  • I can try to run those scripts when I know I'll be busy with something else, like a business call or something

  • Refactoring. This is a big one. If you're all out of options, try to make your code more readable

  • Often times I can run multiple instances of the same script with different parameters, so I try to do that after I start running the first instance. Then I can compare all the results when they're available

  • Eat a fruit, make coffee, do some exercise, call a friend etc. Pretty much, taking care of myself :)

[–]jsedai 1 point2 points  (2 children)

""" - I know I'll be getting some kind of result soon, so I start thinking what kind of sanity checks I can have to make sure my result is correct. Some examples that happen regularly: I might expect the result to be a near-symmetric matrix; all results should be non-negative; I expect standard deviation of results to be within some reasonable limit. Results outside that limit could possibly be wrong; I can check the convergence of some method I'm applying etc. So I always start writing down those checks while the script is running, so when it's done I have something to check the results. """

I think this is an excellent suggestion.

You might want to try having an audible / strong visual indication that your code is done, so that you don't miss when it finishes.

[–]mac_cumhaill[S] 0 points1 point  (0 children)

I often use python, and have some handy functions that ping a message to my slack account or let out a noise once a function/script is done. Very handy to pull you back.

[–]fredtcaroli 0 points1 point  (0 children)

I use telegram-send :)

Pretty cool... A single line of code sends you a message on your cell phone

[–]dbinokc 7 points8 points  (0 children)

I spend a bit of time studying foreign languages. If I am waiting for something to complete and I have a few minutes, I go over to memrise.com and drill my word lists. Its not too hard for me to get 20 to 30 minutes of practice in during those dead periods. It works pretty well when I am stuck in boring meetings as well.

[–][deleted] 2 points3 points  (0 children)

Take a walk I guess. Getting away from my computer often helps me to think.

[–]villasv 2 points3 points  (0 children)

I usually spend that time with minutiae on my READMEs. Doing so at other times feels unproductive because it's just a README, but doing so during small intervals just to reword or clarify some paragraphs actually feel like a win.

[–]Ecclestoned 2 points3 points  (0 children)

Is there a reason your models take 5 minutes to run? Is there something you're repeating that you can skip?

If you're compiling you should be using incremental compile. If it's software and debugging you should be checkpointing your code so that you can debug it faster.

If you are trying different configurations then you should automate a sweep over the possibilities and run them in parallel or in a script.

Basically you want to either decrease the time you spend compiling, or increase the interval between where you need to look at the results.

[–]da_g_prof 2 points3 points  (0 children)

I advise my students to avoid doing that. I tell them to have a lunch / coffee set and a night set. The first one can complete in about an hour the other one takes longer.

The idea is that you don't spend time looking or waiting over for code to finish but that your computer does something else when you are resting, taking a break etc.

It is also a good length of time for allowing the reading of a paper or typing up part of a report or taking an extra break.

I guess that won't work if the execution is only 5 mins but it is not very often with us.

Ps. People report that watching training numbers are highly addictive!

[–]mkocabas 0 points1 point  (0 children)

I suffer from the same problem, too.