v8worker icon indicating copy to clipboard operation
v8worker copied to clipboard

Slow compile time

Open defcube opened this issue 10 years ago • 6 comments

One of the amazing things about Go is how fast it compiles. Since installing the great v8worker lib, my build time has slowed from <1 second to around 20 seconds. This really slows down the TDD workflow that I normally use, because I'm waiting 20 seconds for a unit test to run.

Any suggestions on how to avoid recompiling the v8worker every time I make the project?

defcube avatar Oct 03 '15 22:10 defcube

I noticed a similar increase in compilation but I think it is strongly related to my recent upgrade of Go SDK from 1.4.2 to 1.5.1 for which they rewrote the compiler (C -> Go). I have confidence that the speed will increase again with next versions.

emicklei avatar Oct 04 '15 09:10 emicklei

Thanks for the feedback emicklei. I will hope for better performance in go 1.5.2 or beyond.

defcube avatar Oct 04 '15 10:10 defcube

I guess all the time is when the libv8.a is linked in. Maybe dynamic linking (for development builds) would speed things up.

ry avatar Oct 04 '15 23:10 ry

Can you provide any hints on how to try dynamic linking for development? This has been biting me for a while and I'd love to figure out a way to speed up the build in dev but I'm not very familiar with C++/cgo

mmurray avatar Dec 04 '15 10:12 mmurray

If you want to speed things up during development, one way is to instruct the linker to omit the symbol table and debug info during builds:

go build -ldflags=-s

This will also generate significantly smaller binaries.

tav avatar Dec 05 '16 04:12 tav

FWIW, this is https://github.com/golang/go/issues/12259 .

sethwklein avatar Feb 18 '18 01:02 sethwklein