ugorji / go

idiomatic codec and rpc lib for msgpack, cbor, json, etc. msgpack.org[Go]
MIT License
1.87k stars 295 forks source link

Slow compilation when including this package #152

Closed highlyunavailable closed 8 years ago

highlyunavailable commented 8 years ago

The time it takes for various tools to run/compilation/test builds is increased immensely when using this package.

time go test
real    0m5.857s
user    0m0.015s
sys     0m0.000s

Test time: 0.768s.

I did some investigation in the source and if I pass -tags notfastpath it drops a little bit (probably because it's skipping the nearly 1MB fast-path.generated.go file) but my tools don't pass that so saving the file is still super slow:

time go test -tags notfastpath
real    0m3.094s
user    0m0.000s
sys     0m0.000s

Test time: 0.762s.

Is there any way I can sort of enable a "debug" mode/tag that will let compilation/go fmt/go test happen at normal speed and then re-enable the "slow" compilation via build tag to get runtime speed back later?

This slowdown is is definitely only this package, compilation time drops to less than 1 second if I use the default JSON package, but I want MsgPack spec RPC, and this is the premier package for that sort of stuff.

ugorji commented 8 years ago

You answered your question. Pass the -tags=notfastpath in your tools. I'm not sure what else you are asking.

highlyunavailable commented 8 years ago

Mostly if there was any other tag or tags I was missing that would help speed up compilation. It sounds like the answer is no. Thanks!