Measuring go run and go build times?

65 views
Skip to first unread message

Matt Mueller

unread,
Jul 29, 2020, 5:59:24 PM7/29/20
to golang-nuts
I'm working on a dev tool for automatically reloading the server when you change a file.

I'd like for the reload time to be as fast as possible. Are there any flags or environment variables that I can set to see where the time is being spent (compiling, linking etc.)? Also seeing what packages are cached and which are not would be very helpful.

Also if you have any recommendations for makes this as fast as possible (turning off optimizations, etc.) please let me know!

Thanks!
Matt

 

Ian Lance Taylor

unread,
Jul 29, 2020, 11:37:02 PM7/29/20
to Matt Mueller, golang-nuts
On Wed, Jul 29, 2020 at 2:59 PM Matt Mueller <mattm...@gmail.com> wrote:
>
> I'm working on a dev tool for automatically reloading the server when you change a file.
>
> I'd like for the reload time to be as fast as possible. Are there any flags or environment variables that I can set to see where the time is being spent (compiling, linking etc.)? Also seeing what packages are cached and which are not would be very helpful.

You can get some idea easily by using "go build
-toolexec=/usr/bin/time". That will show for each directory how much
time is taken for each command. You could also use a little shell
script instead of /usr/bin/time that also displays the command.

Ian
Reply all
Reply to author
Forward
0 new messages