4 ms·
> Every program I've written in it (topping out at around 20kloc) compiles instantaneously --- I can't perceive the amount of time it takes to compile. Okay, G
by StavrosK 14y ago
> Every program I've written in it (topping out at around 20kloc) compiles instantaneously --- I can't perceive the amount of time it takes to compile.
Okay, Go is fast, but it's not that fast. My 1000 LoC program takes ~1 second to compile. While it's certainly fast enough for me, it's not imperceptible.
- justin66 14y agoIs this code up anywhere? It'd be interesting to see what's going on there.
- StavrosK 14y agoNo, it's closed-source unfortunately. It might be a bit inaccurate as I only measured the includes in my folder and not everything in the src folder, but it only imports from the stdlib and a redis lib.
- georgemcbay 14y agoThe one pathological case of kinda-slow Go compilation I have involves embedding a very big binary blob (FPGA firmware for a controller chip driving a Texas Instruments DMD array) as a const array of bytes that I can just dump down the usb connection when cold booting the device. I don't fault Go for this as I'm really abusing the language to simplify my single-file deployment without having to do too much work for the simple deploy. If I wanted to spend the time I could do something like append the blob to the end of the program executable instead of just clumsily jamming it into DATA, but this all exists in a library that doesn't need to change often so the fact that it takes ~10-15 seconds to compile is not a problem in practice.
- krasin 14y agoI would suggest to file an issue: https://code.google.com/p/go/issues/list https://code.google.com/p/go/issues/list At least, Go team will be aware of your pathological case and have a chance to speed up it.
- agentS 14y agoI vaguely remembered minux suggesting a way to do this more efficiently, and dug it up: golang.org/issue/3035 Maybe it'll work for your use case.
- georgemcbay 14y agoWow, that (the syso linker thing) is very useful and should work out well in my case, thanks.
- tptacek 14y agoI rebuilt a 15kloc microcontroller emulator I wrote (as my intro- to- Go project) just now, after blitzing my pkg/ directory, and it took about a second.
- StavrosK 14y agoYeah, that sounds about right. My definition of "imperceptible" is around a few ms, I guess. Maybe people coming from C/C++ have different tolerances, but I'm more used to the startup times of interpreted languages.
- signa11 14y ago> I rebuilt a 15kloc microcontroller emulator I wrote (as my intro- to- Go project) just now, after blitzing my pkg/ directory, and it took about a second. that sounds pretty interesting, is there a GitHub page I can look at ? thanks !
- tptacek 14y agoI wrote it for a project and probably won't publish it soon. It's not all that interesting... at least, it's not interesting once you've written a simple emulator, which I highly recommend doing; it's an extremely rewarding personal project, and not nearly as difficult as it sounds. Pick something GCC can compile to.
- vidarh 14y agoThat's within range of gcc on similarly sized projects on anything remotely like a modern machine. I'm surprised this is considered fast.