Hi, recently I've been trying to make my unit test faster. It seems too 
much time were spent on initialization. After removing all init() function 
in relevant packages. The speed was still very slow.It even takes dozens of 
seconds before entering my real unit test function.

So I take a look at all the possible factors that might slow down the 
testing. The only possible reason I can think of is the time cost on 
import. Golang needs to import all packages recursively. And in my 
scenario, that's roughly dozens of packages.Maybe initializing const, var 
takes too much time. 

Is there any solution that could help me figured out the reason? I didn't 
find any tools that could tell me the time cost on import several packages.

And if that's the case,  import a package does take much time, is it still 
possible for me to speed up my unit test? 
 

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/cd58955e-0c4b-4d56-afd7-1153d7be06dcn%40googlegroups.com.

Reply via email to