1. 24 Mar, 2017 14 commits
  2. 23 Mar, 2017 23 commits
  3. 22 Mar, 2017 3 commits
    • Richard Musiol's avatar
      syscall: use CLONE_VFORK and CLONE_VM · 9e6b79a5
      Richard Musiol authored
      This greatly improves the latency of starting a child process when
      the Go process is using a lot of memory. Even though the kernel uses
      copy-on-write, preparation for that can take up to several 100ms under
      certain conditions. All other goroutines are suspended while starting
      a subprocess so this latency directly affects total throughput.
      
      With CLONE_VM the child process shares the same memory with the parent
      process. On its own this would lead to conflicting use of the same
      memory, so CLONE_VFORK is used to suspend the parent process until the
      child releases the memory when switching to to the new program binary
      via the exec syscall. When the parent process continues to run, one
      has to consider the changes to memory that the child process did,
      namely the return address of the syscall function needs to be restored
      from a register.
      
      A simple benchmark has shown a difference in latency of 16ms vs. 0.5ms
      at 10GB memory usage. However, much higher latencies of several 100ms
      have been observed in real world scenarios. For more information see
      comments on #5838.
      
      Fixes #5838
      
      Change-Id: I6377d7bd8dcd00c85ca0c52b6683e70ce2174ba6
      Reviewed-on: https://go-review.googlesource.com/37439Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      9e6b79a5
    • Sarah Adams's avatar
      encoding/xml: unmarshal allow empty, non-string values · 0a0186fb
      Sarah Adams authored
      When unmarshaling, if an element is empty, eg. '<tag></tag>', and
      destination type is int, uint, float or bool, do not attempt to parse
      value (""). Set to its zero value instead.
      
      Fixes #13417
      
      Change-Id: I2d79f6d8f39192bb277b1a9129727d5abbb2dd1f
      Reviewed-on: https://go-review.googlesource.com/38386Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      0a0186fb
    • Kenny Grant's avatar
      net/http: improve speed of default mux · 1295b745
      Kenny Grant authored
      The DefaultServeMux included in net/http uses a map to store routes,
      but iterates all keys for every request to allow longer paths.
      
      This change checks the map for an exact match first.
      
      To check performance was better, BenchmarkServeMux has been added -
      this adds >100 routes and checks the matches.
      
      Exact matches are faster and more predictable on this benchmark
      and on most existing package benchmarks.
      
      https://perf.golang.org/search?q=upload:20170312.1
      
      ServeMux-4  2.02ms ± 2%	0.04ms ± 2%  −98.08%  (p=0.004 n=5+6)
      
      https://perf.golang.org/search?q=upload:20170312.2
      
      ReadRequestChrome-4	184MB/s  ± 8%	186MB/s  ± 1%	~
      ReadRequestCurl-4	45.0MB/s ± 1%	46.2MB/s ± 1%	+2.71%
      Read...Apachebench-4	45.8MB/s ±13%	48.7MB/s ± 1%	~
      ReadRequestSiege-4	63.6MB/s ± 5%	69.2MB/s ± 1%	+8.75%
      ReadRequestWrk-4	30.9MB/s ± 9%	34.4MB/s ± 2%	+11.25%
      
      Change-Id: I8afafcb956f07197419d545a9f1c03ecaa307384
      Reviewed-on: https://go-review.googlesource.com/38057Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      1295b745