FAQ
On my own system (Quad-core i7 with 8GB of RAM) it consistently takes about
2-3 seconds to compile a simple "hello world" program.

Pretty much anything I've compiled so far turns around in the same time,
which suggests to me that there may be some kind of overhead, not from
actually compiling the sources, but from launching the compiler.

I'm not going to complain about the performance, since this is already
faster than most compilers - but I noticed that, on the Go playground, the
turn-around time is barely noticeable at all, even for longer examples, and
so I have to wonder if there's some kind of overhead on my system for some
reason... I think it ought to be quicker locally than going over the web to
a shared server?

How quick is the compiler (for simple programs) on your system?

Is there an overhead for the compiler on Window that doesn't affect e.g.
Linux users?

Thanks,
    Rasmus

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Justin Israel at Dec 31, 2013 at 10:53 pm
    I don't have a windows box handy to check, but for a "Hello World" on my:
         OSX (8 core mac pro): ~0.35s
         Ubuntu VM (2 cores): ~0.37s

    On Wed, Jan 1, 2014 at 11:36 AM, Rasmus Schultz wrote:

    On my own system (Quad-core i7 with 8GB of RAM) it consistently takes
    about 2-3 seconds to compile a simple "hello world" program.

    Pretty much anything I've compiled so far turns around in the same time,
    which suggests to me that there may be some kind of overhead, not from
    actually compiling the sources, but from launching the compiler.

    I'm not going to complain about the performance, since this is already
    faster than most compilers - but I noticed that, on the Go playground, the
    turn-around time is barely noticeable at all, even for longer examples, and
    so I have to wonder if there's some kind of overhead on my system for some
    reason... I think it ought to be quicker locally than going over the web to
    a shared server?

    How quick is the compiler (for simple programs) on your system?

    Is there an overhead for the compiler on Window that doesn't affect e.g.
    Linux users?

    Thanks,
    Rasmus

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Robert Melton at Dec 31, 2013 at 10:59 pm
    I do have a windows box handy!

    Windows 8.1 (i7 3610QM): ~0.33s

    Details from timeit (from the 2003 Resource Kit):
    Elapsed Time: 0:00:00.334
    Process Time: 0:00:00.062
    System Calls: 30898
    Context Switches: 9872
    Page Faults: 19690
    Bytes Read: 7788225
    Bytes Written: 2731423
    Bytes Other: 136356
    On Tue, Dec 31, 2013 at 5:53 PM, Justin Israel wrote:
    I don't have a windows box handy to check, but for a "Hello World" on my:
    OSX (8 core mac pro): ~0.35s
    Ubuntu VM (2 cores): ~0.37s

    On Wed, Jan 1, 2014 at 11:36 AM, Rasmus Schultz wrote:

    On my own system (Quad-core i7 with 8GB of RAM) it consistently takes
    about 2-3 seconds to compile a simple "hello world" program.

    Pretty much anything I've compiled so far turns around in the same time,
    which suggests to me that there may be some kind of overhead, not from
    actually compiling the sources, but from launching the compiler.

    I'm not going to complain about the performance, since this is already
    faster than most compilers - but I noticed that, on the Go playground, the
    turn-around time is barely noticeable at all, even for longer examples, and
    so I have to wonder if there's some kind of overhead on my system for some
    reason... I think it ought to be quicker locally than going over the web to
    a shared server?

    How quick is the compiler (for simple programs) on your system?

    Is there an overhead for the compiler on Window that doesn't affect e.g.
    Linux users?

    Thanks,
    Rasmus

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    Robert Melton

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Caleb Doxsey at Dec 31, 2013 at 11:20 pm
    Just guessing here, but I've noticed that on windows the resulting binary
    is sometimes rather large... is it possible you have a slowish hard drive?

    On Tue, Dec 31, 2013 at 3:58 PM, Robert Melton wrote:

    I do have a windows box handy!

    Windows 8.1 (i7 3610QM): ~0.33s

    Details from timeit (from the 2003 Resource Kit):
    Elapsed Time: 0:00:00.334
    Process Time: 0:00:00.062
    System Calls: 30898
    Context Switches: 9872
    Page Faults: 19690
    Bytes Read: 7788225
    Bytes Written: 2731423
    Bytes Other: 136356
    On Tue, Dec 31, 2013 at 5:53 PM, Justin Israel wrote:
    I don't have a windows box handy to check, but for a "Hello World" on my:
    OSX (8 core mac pro): ~0.35s
    Ubuntu VM (2 cores): ~0.37s

    On Wed, Jan 1, 2014 at 11:36 AM, Rasmus Schultz wrote:

    On my own system (Quad-core i7 with 8GB of RAM) it consistently takes
    about 2-3 seconds to compile a simple "hello world" program.

    Pretty much anything I've compiled so far turns around in the same time,
    which suggests to me that there may be some kind of overhead, not from
    actually compiling the sources, but from launching the compiler.

    I'm not going to complain about the performance, since this is already
    faster than most compilers - but I noticed that, on the Go playground,
    the
    turn-around time is barely noticeable at all, even for longer examples,
    and
    so I have to wonder if there's some kind of overhead on my system for
    some
    reason... I think it ought to be quicker locally than going over the
    web to
    a shared server?

    How quick is the compiler (for simple programs) on your system?

    Is there an overhead for the compiler on Window that doesn't affect e.g.
    Linux users?

    Thanks,
    Rasmus

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    Robert Melton

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dave Cheney at Dec 31, 2013 at 11:27 pm
    More likely, do you have a slowish anti virus program?
    On 1 Jan 2014, at 10:20, Caleb Doxsey wrote:

    Just guessing here, but I've noticed that on windows the resulting binary is sometimes rather large... is it possible you have a slowish hard drive?

    On Tue, Dec 31, 2013 at 3:58 PM, Robert Melton wrote:
    I do have a windows box handy!

    Windows 8.1 (i7 3610QM): ~0.33s

    Details from timeit (from the 2003 Resource Kit):
    Elapsed Time: 0:00:00.334
    Process Time: 0:00:00.062
    System Calls: 30898
    Context Switches: 9872
    Page Faults: 19690
    Bytes Read: 7788225
    Bytes Written: 2731423
    Bytes Other: 136356
    On Tue, Dec 31, 2013 at 5:53 PM, Justin Israel wrote:
    I don't have a windows box handy to check, but for a "Hello World" on my:
    OSX (8 core mac pro): ~0.35s
    Ubuntu VM (2 cores): ~0.37s

    On Wed, Jan 1, 2014 at 11:36 AM, Rasmus Schultz wrote:

    On my own system (Quad-core i7 with 8GB of RAM) it consistently takes
    about 2-3 seconds to compile a simple "hello world" program.

    Pretty much anything I've compiled so far turns around in the same time,
    which suggests to me that there may be some kind of overhead, not from
    actually compiling the sources, but from launching the compiler.

    I'm not going to complain about the performance, since this is already
    faster than most compilers - but I noticed that, on the Go playground, the
    turn-around time is barely noticeable at all, even for longer examples, and
    so I have to wonder if there's some kind of overhead on my system for some
    reason... I think it ought to be quicker locally than going over the web to
    a shared server?

    How quick is the compiler (for simple programs) on your system?

    Is there an overhead for the compiler on Window that doesn't affect e.g.
    Linux users?

    Thanks,
    Rasmus

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    Robert Melton

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Jsor at Jan 1, 2014 at 4:11 am

    On Tuesday, December 31, 2013 4:27:23 PM UTC-7, Dave Cheney wrote:
    More likely, do you have a slowish anti virus program?
    This is my vote, I have a similar setup to the OP and I had speed problems
    before I made exceptions. To be fair, go build was always fast. It was go
    run that took forever, becuase the antivirus would always try and sandbox
    the file in the temp directory (until I made a blanket exclusion for all
    go-related temp paths).

    My Windows go programs still benchmark much slower than on other OSs, but
    I'm not sure if they're really a lot slower or if it's just an issue of OS
    clock precision or something.

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Justin Israel at Jan 1, 2014 at 5:13 am
    @andry: My OSX build time was an average of about 10 runs on and SSD drive
    On Jan 1, 2014 5:11 PM, "Jsor" wrote:


    On Tuesday, December 31, 2013 4:27:23 PM UTC-7, Dave Cheney wrote:

    More likely, do you have a slowish anti virus program?
    This is my vote, I have a similar setup to the OP and I had speed problems
    before I made exceptions. To be fair, go build was always fast. It was go
    run that took forever, becuase the antivirus would always try and sandbox
    the file in the temp directory (until I made a blanket exclusion for all
    go-related temp paths).

    My Windows go programs still benchmark much slower than on other OSs, but
    I'm not sure if they're really a lot slower or if it's just an issue of OS
    clock precision or something.
    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Alex Skinner at Jan 1, 2014 at 6:27 am
    The answer is simple... Don't use windows. In honesty, your performance vs hardware is way off, so I'm going to go with the antivirus argument also. But the bigger part of me wants to tell you to just use Linux :)

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Andrey mirtchovski at Dec 31, 2013 at 11:45 pm

    I don't have a windows box handy to check, but for a "Hello World" on my:
    OSX (8 core mac pro): ~0.35s
    Ubuntu VM (2 cores): ~0.37s
    that OSX time looks high. you will get a lower time if you run go
    build a couple of times in succession.

    both osx and linux's vfs are caching aggressively. if you're doing
    anything involving the file system significantly between recompiles
    you may see the "true" cost of the compile exposed. the go tool looks
    at all imported packages to build a tree of what may need to be
    recompiled. currently go opens 370 files when compiling hello world
    and out of the 800+ reads that the go program does, at least 300 are
    reads to different files from the standard package directory. you
    normally pay this cost up-front once, but I've found myself having to
    wait for the "go" command more than usual on an otherwise busy system
    with a slow hard drive.

    to see the difference caching makes on OSX one can use the 'purge'
    command (4-core macbook pro):

    % /usr/bin/time go build t.go
             0.16 real 0.12 user 0.03 sys
    % sudo purge
    % /usr/bin/time go build t.go
            11.42 real 0.18 user 0.14 sys
    %

    the times are similar with linux if one does "echo 3 >
    /proc/sys/vm/drop_caches". on Plan 9 this is even more pronounced
    because the filesystem lacks any caching. each go build is 11+ seconds
    there :(

    if it's not an antivirus it could be the vfs, just saying.

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Andrey mirtchovski at Dec 31, 2013 at 11:46 pm
    reads to different files from the standard package directory
    i should clarify this better: different _source_ files from the
    src/pkg directory.

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Caleb Spare at Dec 31, 2013 at 10:55 pm
    I have not used Go on windows. On all the machines I've used it (Linux/OS
    X), it is much faster.

    $ cat hello.go
    package main

    import "fmt"

    func main() {
             fmt.Println("Hello")
    }
    $ time go build hello.go

    real 0m0.162s
    user 0m0.134s
    sys 0m0.026s
    $ time ./hello
    Hello

    real 0m0.001s
    user 0m0.000s
    sys 0m0.001s

    Also keep in mind that the playground caches the output of programs it
    runs, so it's probably not compiling or running the code again if you run
    something twice.

    -Caleb

    On Tue, Dec 31, 2013 at 2:36 PM, Rasmus Schultz wrote:

    On my own system (Quad-core i7 with 8GB of RAM) it consistently takes
    about 2-3 seconds to compile a simple "hello world" program.

    Pretty much anything I've compiled so far turns around in the same time,
    which suggests to me that there may be some kind of overhead, not from
    actually compiling the sources, but from launching the compiler.

    I'm not going to complain about the performance, since this is already
    faster than most compilers - but I noticed that, on the Go playground, the
    turn-around time is barely noticeable at all, even for longer examples, and
    so I have to wonder if there's some kind of overhead on my system for some
    reason... I think it ought to be quicker locally than going over the web to
    a shared server?

    How quick is the compiler (for simple programs) on your system?

    Is there an overhead for the compiler on Window that doesn't affect e.g.
    Linux users?

    Thanks,
    Rasmus

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Andy Balholm at Jan 1, 2014 at 12:04 am
    I've noticed that compiling software with GCC on Windows tends to be much
    slower than on Mac and Linux. I think it is the overhead of starting new
    processes. Configure scripts are especially bad. At least Go doesn't use
    Autoconf.

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Robert Melton at Jan 1, 2014 at 1:06 am

    On Tue, Dec 31, 2013 at 7:04 PM, Andy Balholm wrote:
    I've noticed that compiling software with GCC on Windows tends to be much
    slower than on Mac and Linux. I think it is the overhead of starting new
    processes.
    On the same hardware, it is about ~0.33s under windows, and ~0.21
    under Linux (CentOS 6.4), both with Go 1.2.

    Just to check some peoples theory that it might be a spinning disk
    issue. I tried building on a USB3 spinning disk drive (and a cheapo)
    on Windows 8.1. Added about .05s (0.33s to 0.38s).

    I really suspect something else is going on the system Rasmus is
    building on. Anti-virus or something more esoteric.

    --
    Robert Melton

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Rasmus Schultz at Jan 1, 2014 at 7:56 pm
    I really suspect something else is going on the system Rasmus is building
    on. Anti-virus or something more esoteric.

    Aha, good bet! I excluded GOROOT and GOPATH from my anti-virus scanner, and
    it just cut the compile-time in half! :-)

    My hard drive isn't blazing fast. (I had to choose between size and speed,
    so I chose size.)

    Apparently file access is just that much more optimized on Linux and OSX
    than it is on Windows - I wonder if they're ever going to improve that... I
    wonder if there are any third-party drive performance tools for Windows
    that add more aggressive caching or something...


    On Tue, Dec 31, 2013 at 8:06 PM, Robert Melton wrote:
    On Tue, Dec 31, 2013 at 7:04 PM, Andy Balholm wrote:
    I've noticed that compiling software with GCC on Windows tends to be much
    slower than on Mac and Linux. I think it is the overhead of starting new
    processes.
    On the same hardware, it is about ~0.33s under windows, and ~0.21
    under Linux (CentOS 6.4), both with Go 1.2.

    Just to check some peoples theory that it might be a spinning disk
    issue. I tried building on a USB3 spinning disk drive (and a cheapo)
    on Windows 8.1. Added about .05s (0.33s to 0.38s).

    I really suspect something else is going on the system Rasmus is
    building on. Anti-virus or something more esoteric.

    --
    Robert Melton

    --
    You received this message because you are subscribed to a topic in the
    Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/golang-nuts/GaouPBN0JVk/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to
    golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Brainman at Jan 1, 2014 at 3:18 am

    On Wednesday, 1 January 2014 09:36:59 UTC+11, Rasmus Schultz wrote:
    ... How quick is the compiler (for simple programs) on your system?
    This program

    package main

    import (
    "errors"
    "fmt"
    "io/ioutil"
    "log"
    "os"
    "os/exec"
    "path/filepath"
    "time"
    )

    func runGoCmd() (time.Duration, error) {
    const src = `
    package main

    func main() {
             println("hello")
    }
    `
    dir, err := ioutil.TempDir("", "go-build")
    if err != nil {
    return 0, errors.New("failed to create temp directory: " + err.Error())
    }
    defer os.RemoveAll(dir)

    path := filepath.Join(dir, "main.go")
    err = ioutil.WriteFile(path, []byte(src), 0644)
    if err != nil {
    return 0, errors.New("failed to create source file: " + err.Error())
    }

    start := time.Now()
    _, err = exec.Command("go", "build", path).CombinedOutput()
    if err != nil {
    return 0, errors.New("failed to run command: " + err.Error())
    }
    return time.Since(start), nil
    }

    func main() {
    t, err := runGoCmd()
    if err != nil {
    log.Fatal(err)
    }
    fmt.Printf("run time is %v\n", t)
    }

    prints

    run time is 225.0129ms

    on my windows/amd64 laptop

    and

    run time is 149.617922ms

    on my old linux/386 pc.
    ... Is there an overhead for the compiler on Window that doesn't affect
    e.g. Linux users?

    Not really. Perhaps starting new process (and "go build ..." command starts
    a few) takes bit longer on Windows. But my time figures look reasonable to
    me. It should not take 2-3 seconds. Perhaps you have some antivirus program
    that monitors / controls what is happening on your system. Perhaps your
    PATH has too many directories (with too many files) listed. Perhaps
    something else. You can try and investigate - source of go command is in
    "cmd/go" - just put some prints in there to measure where all that time
    goes.

    Alex

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • peterGo at Nov 28, 2014 at 4:02 pm
    Alex,

    For a valid comparison, you need to change only one variable, the OS. I ran
    your program on identical hardware, a computer which dual boots Windows and
    Linux. The disk is an SSD. On Windows, I ran without and with an
    anti-malware program (MSE). As you can see, Windows is significantly slower
    than Linux.

    $ uname -a
    Linux peter 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014
    x86_64 x86_64 x86_64 GNU/Linux
    $ go version
    go version devel +ffe33f1f1f17 Tue Nov 25 15:41:33 2014 +1100 linux/amd64
    $ go run brainman.go
    run time is 169.80454ms
    $ go run brainman.go
    run time is 182.3602ms
    $ go run brainman.go
    run time is 168.121334ms
    $ go run brainman.go
    run time is 167.168104ms
    $ go run brainman.go
    run time is 172.321024ms
    $ go run brainman.go
    run time is 199.772498ms
    $ go run brainman.go
    run time is 172.234077ms
    $

    Microsoft Windows [Version 6.1.7601]
    C:\>go version
    go version devel +ffe33f1f1f17 Tue Nov 25 15:41:33 2014 +1100 windows/amd64
    <<MSE OFF>>
    C:\>go run brainman.go
    run time is 342.0196ms
    C:\>go run brainman.go
    run time is 332.019ms
    C:\>go run brainman.go
    run time is 318.0182ms
    C:\>go run brainman.go
    run time is 323.0185ms
    C:\>go run brainman.go
    run time is 360.0205ms
    C:\>go run brainman.go
    run time is 337.0193ms
    <<MSE ON>>
    C:\>go run brainman.go
    run time is 417.0239ms
    C:\>go run brainman.go
    run time is 502.0287ms
    C:\>go run brainman.go
    run time is 488.0279ms
    C:\>go run brainman.go
    run time is 440.0252ms
    C:\>go run brainman.go
    run time is 375.0215ms
    C:\>go run brainman.go
    run time is 353.0202ms
    C:\>

    Peter
    On Tuesday, December 31, 2013 10:18:50 PM UTC-5, brainman wrote:
    On Wednesday, 1 January 2014 09:36:59 UTC+11, Rasmus Schultz wrote:
    ... How quick is the compiler (for simple programs) on your system?
    This program

    package main

    import (
    "errors"
    "fmt"
    "io/ioutil"
    "log"
    "os"
    "os/exec"
    "path/filepath"
    "time"
    )

    func runGoCmd() (time.Duration, error) {
    const src = `
    package main

    func main() {
    println("hello")
    }
    `
    dir, err := ioutil.TempDir("", "go-build")
    if err != nil {
    return 0, errors.New("failed to create temp directory: " + err.Error())
    }
    defer os.RemoveAll(dir)

    path := filepath.Join(dir, "main.go")
    err = ioutil.WriteFile(path, []byte(src), 0644)
    if err != nil {
    return 0, errors.New("failed to create source file: " + err.Error())
    }

    start := time.Now()
    _, err = exec.Command("go", "build", path).CombinedOutput()
    if err != nil {
    return 0, errors.New("failed to run command: " + err.Error())
    }
    return time.Since(start), nil
    }

    func main() {
    t, err := runGoCmd()
    if err != nil {
    log.Fatal(err)
    }
    fmt.Printf("run time is %v\n", t)
    }

    prints

    run time is 225.0129ms

    on my windows/amd64 laptop

    and

    run time is 149.617922ms

    on my old linux/386 pc.
    ... Is there an overhead for the compiler on Window that doesn't affect
    e.g. Linux users?

    Not really. Perhaps starting new process (and "go build ..." command
    starts a few) takes bit longer on Windows. But my time figures look
    reasonable to me. It should not take 2-3 seconds. Perhaps you have some
    antivirus program that monitors / controls what is happening on your
    system. Perhaps your PATH has too many directories (with too many files)
    listed. Perhaps something else. You can try and investigate - source of go
    command is in "cmd/go" - just put some prints in there to measure where all
    that time goes.

    Alex
    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • John C. at Jan 1, 2014 at 6:05 pm
    Out of curiosity, try making a batch file that uses 6g/6l or 8g/8l instead
    of "go build" and see how long it takes. I think there is something going
    on with how "go build" has to look around the file system, etc., whereas
    with 6g/6l or 8g/8l don't look around, they just use what you tell them at
    the command line.
    On Tuesday, December 31, 2013 5:36:59 PM UTC-5, Rasmus Schultz wrote:

    On my own system (Quad-core i7 with 8GB of RAM) it consistently takes
    about 2-3 seconds to compile a simple "hello world" program.

    Pretty much anything I've compiled so far turns around in the same time,
    which suggests to me that there may be some kind of overhead, not from
    actually compiling the sources, but from launching the compiler.

    I'm not going to complain about the performance, since this is already
    faster than most compilers - but I noticed that, on the Go playground, the
    turn-around time is barely noticeable at all, even for longer examples, and
    so I have to wonder if there's some kind of overhead on my system for some
    reason... I think it ought to be quicker locally than going over the web to
    a shared server?

    How quick is the compiler (for simple programs) on your system?

    Is there an overhead for the compiler on Window that doesn't affect e.g.
    Linux users?

    Thanks,
    Rasmus
    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Harald Weidner at Jan 2, 2014 at 9:12 am
    Hello,

    Rasmus Schultz <rasmus@mindplay.dk>:
    On my own system (Quad-core i7 with 8GB of RAM) it consistently takes about
    2-3 seconds to compile a simple "hello world" program.

    Pretty much anything I've compiled so far turns around in the same time,
    which suggests to me that there may be some kind of overhead, not from
    actually compiling the sources, but from launching the compiler.
    I had a similar effect after updating the golang Package on Linux.

    By using "go build -x", it turned out that many 3rd libraries were
    recompiled at every build, although the corresponding *.a files were
    present under $GOPATH/pkg. Go ignores *.a files if they are build
    with an older version, so it is recommended to delete the *.a files
    after each update of golang.

    Harald

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dave Cheney at Jan 2, 2014 at 9:17 am

    On Thu, Jan 2, 2014 at 8:12 PM, Harald Weidner wrote:

    Hello,

    Rasmus Schultz <rasmus@mindplay.dk>:
    On my own system (Quad-core i7 with 8GB of RAM) it consistently takes about
    2-3 seconds to compile a simple "hello world" program.

    Pretty much anything I've compiled so far turns around in the same time,
    which suggests to me that there may be some kind of overhead, not from
    actually compiling the sources, but from launching the compiler.
    I had a similar effect after updating the golang Package on Linux.

    By using "go build -x", it turned out that many 3rd libraries were
    recompiled at every build, although the corresponding *.a files were
    present under $GOPATH/pkg. Go ignores *.a files if they are build
    with an older version, so it is recommended to delete the *.a files
    after each update of golang.
    This is incorrect. Use `go install` to `install` new compiled packages. You
    can also use `go install all` to reinstall everything in your $GOPATH.

    Harald

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Ignacio Grande at Jan 2, 2014 at 12:42 pm
    Are you using Cygwin? I have noticed that Cygwin takes a lot to run a
    program, or maybe it is Windows but I notice it while using Cygwin because
    I don't use Windows' command line interpreter.

    For example, a simple script that calls a thousand times a simple command
    will take a lot, just by invoking the command. The same happens with GCC or
    Go, as several binaries are executed to compile a program and each
    execution is a delay.


    On Tuesday, December 31, 2013 11:36:59 PM UTC+1, Rasmus Schultz wrote:

    On my own system (Quad-core i7 with 8GB of RAM) it consistently takes
    about 2-3 seconds to compile a simple "hello world" program.
    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Rasmus Schultz at Jan 2, 2014 at 3:14 pm
    I did some searching, and supposedly, caching in the Windows file system is
    just a joke, more or less - there are applications available that introduce
    better or more aggressive read/write caching:

    http://www.superspeed.com/desktop/supercache.php

    http://www.romexsoftware.com/en-us/primo-cache/index.html

    I haven't tried one yet, so I don't know how drastic the improvements are,
    but the numbers on one of those pages seem to indicate dozens of times
    faster access... most likely the same ideas/technology is just standard in
    Linux/OSX, probably has been for a long time, and Windows is just
    hopelessly behind as usual? ;-)


    On Thu, Jan 2, 2014 at 7:42 AM, Ignacio Grande wrote:

    Are you using Cygwin? I have noticed that Cygwin takes a lot to run a
    program, or maybe it is Windows but I notice it while using Cygwin because
    I don't use Windows' command line interpreter.

    For example, a simple script that calls a thousand times a simple command
    will take a lot, just by invoking the command. The same happens with GCC or
    Go, as several binaries are executed to compile a program and each
    execution is a delay.


    On Tuesday, December 31, 2013 11:36:59 PM UTC+1, Rasmus Schultz wrote:

    On my own system (Quad-core i7 with 8GB of RAM) it consistently takes
    about 2-3 seconds to compile a simple "hello world" program.

    --
    You received this message because you are subscribed to a topic in the
    Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/golang-nuts/GaouPBN0JVk/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to
    golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Rasmus Schultz at Jan 10, 2014 at 9:48 pm
    For the record,

    I just uninstalled previous Go 1.1 and installed Go 1.2, and building
    became about 4 times slower!

    Good news is, I found the culprit - it's Panda Cloud Anti-Virus.

    Even with exclusions for GOROOT and GOPATH configured, "go test" for a
    "hello world" app takes 5 seconds now after upgrading to Go 1.2.

    However, with Panda completely disabled, I now get build speeds of 0.06 -
    0.1 seconds, which is even faster than the speeds most of you reported on
    OSX and Linux?!? :-)

    Now to find myself a new anti-virus package...

    Any of you using LiteIDE? I'm finding that, under a console, "go test"
    takes about a second in real time, though it reports much smaller numbers -
    it's reporting the time it took to run the actual test, obviously. What's
    odd is that, under LiteIDE, running a test takes considerably longer, like
    3 seconds - even with Panda turned off. Any ideas why?

    On Tuesday, December 31, 2013 5:36:59 PM UTC-5, Rasmus Schultz wrote:

    On my own system (Quad-core i7 with 8GB of RAM) it consistently takes
    about 2-3 seconds to compile a simple "hello world" program.

    Pretty much anything I've compiled so far turns around in the same time,
    which suggests to me that there may be some kind of overhead, not from
    actually compiling the sources, but from launching the compiler.

    I'm not going to complain about the performance, since this is already
    faster than most compilers - but I noticed that, on the Go playground, the
    turn-around time is barely noticeable at all, even for longer examples, and
    so I have to wonder if there's some kind of overhead on my system for some
    reason... I think it ought to be quicker locally than going over the web to
    a shared server?

    How quick is the compiler (for simple programs) on your system?

    Is there an overhead for the compiler on Window that doesn't affect e.g.
    Linux users?

    Thanks,
    Rasmus
    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Z99 at Nov 28, 2014 at 2:04 pm
    Had the same problem, turns out it was Mcafee Antivirus, after disabling on
    Access scan, "go run" ran immediately without the delay.
    On Wednesday, January 1, 2014 12:36:59 AM UTC+2, Rasmus Schultz wrote:

    On my own system (Quad-core i7 with 8GB of RAM) it consistently takes
    about 2-3 seconds to compile a simple "hello world" program.

    Pretty much anything I've compiled so far turns around in the same time,
    which suggests to me that there may be some kind of overhead, not from
    actually compiling the sources, but from launching the compiler.

    I'm not going to complain about the performance, since this is already
    faster than most compilers - but I noticed that, on the Go playground, the
    turn-around time is barely noticeable at all, even for longer examples, and
    so I have to wonder if there's some kind of overhead on my system for some
    reason... I think it ought to be quicker locally than going over the web to
    a shared server?

    How quick is the compiler (for simple programs) on your system?

    Is there an overhead for the compiler on Window that doesn't affect e.g.
    Linux users?

    Thanks,
    Rasmus
    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

People

Translate

site design / logo © 2022 Grokbase