6 ms·
Ask HN: How do you stay focused while it's compiling?
Nowadays, every time I need to compile and run my code, it takes about 3 minutes to complete, before it finally starts running.
These three minutes are usually enough for me to open hackernews, reddit or some other news website, and... voilà, just lost 20 more minutes.
So...
What do you do during long compiles? Can you stay focused?
- smt88 10y agoAdd a loud noise to the end of compilation, like a fog horn or something. Assuming you're not writing web software and compiling locally, you could also add a command to kill your Chrome processes. If you lost a tab you really liked, you could always pull it back from your history.
- randomanybody 10y agoone thing that worked for me was iterm and growl integration to show me a system notification on compilation completion.
- dllthomas 10y agoI do this with PROMPT_COMMAND and notify-send.
- w_t_payne 10y agotup
- humbleMouse 10y agoConsider yourself lucky. Where I work it takes 20 minutes to compile the app, and another 6 minutes to start the server. I'm not kidding.
- 7Z7 10y agoAgreed. My Houdini sims and cooks are between 10-20 minutes per stage. Evil.
- abc_lisper 10y agoRun dude. More seriously, people who don't value your time don't value you.
- amcrouch 10y agoRead only short articles that you have found during your surfing. Most articles these days only take a few mins to read and you learn while you compile!
- gcp 10y agoBut they have links! Interesting links!
- gcp 10y agoOr build system pops up a desktop notification when the build finishes. Fairly easy to do on Linux with dbus.
- AnimalMuppet 10y agoGo look out the window. It makes you get up and walk for a bit, which isn't bad. It also is something that you're probably not going to do for 20 minutes, so you'll come back sooner. (I say that, but I usually look at HN...)
- weberc2 10y agoThis isn't a direct solution to your problem, but when I worked on a large C++ code base, I found it tremendously helpful to lean more on unit tests as a source of fast feedback for a particular code unit rather than compiling and booting the whole app for a manual test. Manual tests will still be necessary, but they should be less frequent so your long compiles will be less frequent as well. Even less helpful for you, I recently been able to use Go more frequently, so I have no more long compile times. :p
- abc_lisper 10y agoThis is true. I have seen some very effective programmers do this. They do this even when playing with a new library.
- baccheion 10y agoI'd go completely insane if it took more than a few seconds to compile something, especially as I like compiling frequently. I remember having to work in Java codebases, and it was an absolute nightmare. Slow was the name of the game at all levels: slow to design anything, slow to write the code required, slow to navigate, slow to compile, slow to start, etc. What are the nature of the changes you're making? Is it something you can write and debug in another (faster) language, then translate to the main language? If you were able to do it this way, then you wouldn't need as many compilations.
- abc_lisper 10y agoYeah, use clojure! :D
- seanwilson 10y ago> I'd go completely insane if it took more than a few seconds to compile something, especially as I like compiling frequently. I know what you mean. For example, once you get used to working on JavaScript web apps that have almost instant live reload time on save it's very, very painful going back to apps with a 10s compile/reload time let alone over a minute.
- Cyph0n 10y agoWhat language are you using now that has faster compile times with a codebase similar in size to what you worked on in Java?
- baccheion 10y agoIt seems to be more than compile times. Something about Java, the IDE, and all the other tools/plugins/whatever make it painful to use. The first thing that usually happens when there's a switch from Java to most other languages is a shrinking of the codebase. That is, it's not uncommon to go from 200,000 lines of code to 20-30,000. If you still need the runtime speed Java offers, then that's one thing, otherwise, you can use some dynamically typed language like Python or Ruby. I suppose there's also Go, as many can't go without static types. At the end of the day (especially if all compile times end up being similar), I'd prefer almost any other language over Java. Swift, Kotlin, Nim, Rust, Elixir, Crystal, Julia, D, C#, anything.
- thoughtpalette 10y agoMy staging build takes around 8 minutes due to some bad optipng task or something, and my API only works on staging so I usually just browse HN or reddit during that time. I typically enjoy the break unless I have something urgent to deploy.
- bronlund 10y agoI always have one of those learning sites open in a tab and try to go there when I have to wait. At the moment it's pluralsight.com.
- bbcbasic 10y agoSeems like a lot of context switching.
- swordsmith 10y agoDo 30 pushups during every compile cycle. Or any other body weight exercise.
- jboggan 10y agoCame here and read this while 115,508 packages complied. So, no.
- merb 10y agoI always wonder about people that need a extreme fast feedback cycle. I mean most of the time I do things, I actually think about new code, watch a side project, discuss in gitter. Our code's full test suite takes longer than 10 minutes and I still feel pretty productive when working at it. Actually we lint/transpile our JavaScript with Google Closure which is faster than webpack, but it still takes over 5 seconds which is more than our scala app takes in continous compile? Also I always see these cool JavaScript people, but I've never seen any real world app that still has a amazingly fast micro seconds cycle.
- mherrmann 10y agoProbably easier said than done, but why not invest these 3 minutes into trying to speed up the build, or equivalently, trying to split it into smaller parts?
- afarrell 10y agoI use https://freedom.to/ https://freedom.to/ to block HN and Reddit. If I'm doing something that is very stop-and-go, I listen to a podcast or audiobook.
- source99 10y agoA few years back I was compiling hardware inside an FPGA. Typical "compile" times were 2-3 hours. I used to read a book while waiting for compiles when I was in High School. I have test suites that take 5-20 minutes to run and I do just about everything I can to cache data to bring that time down. I feel your pain.
- 75j 10y ago3 minutes is just enough time to stand up, walk around a bit, rest your eyes, stretch, and get a drink of water. That's probably what I would do.
- deleted 10y ago[deleted]