1. 14 Mar, 2016 4 commits
    • Josh Bleecher Snyder's avatar
      cmd/compile: write some static data directly · 7c18f8cd
      Josh Bleecher Snyder authored
      Instead of generating ADATA instructions for
      static data, write that static data directly
      into the linker sym.
      This is considerably more efficient.
      The assembler still generates
      ADATA instructions, so the ADATA machinery
      cannot be dismantled yet. (Future work.)
      Skipping ADATA has a significant impact
      compiling the unicode package, which has lots
      of static data.
      
      name     old time/op    new time/op    delta
      Unicode     227ms ±10%     192ms ± 4%  -15.61%  (p=0.000 n=29+30)
      
      name     old alloc/op   new alloc/op   delta
      Unicode    51.0MB ± 0%    45.8MB ± 0%  -10.29%  (p=0.000 n=30+30)
      
      name     old allocs/op  new allocs/op  delta
      Unicode      610k ± 0%      578k ± 0%   -5.29%  (p=0.000 n=30+30)
      
      This does not pass toolstash -cmp, because
      this changes the order in which some relocations
      get added, and thus it changes the output from
      the compiler. It is not worth the execution time
      to sort the relocs in the normal case.
      
      However, compiling with -S -v generates identical
      output if (1) you suppress printing of ADATA progs
      in flushplist and (2) you suppress printing of
      cpu timing. It is reasonable to suppress printing
      the ADATA progs, since the data itself is dumped
      later. I am therefore fairly confident that all
      changes are superficial and non-functional.
      
      Fixes #14786, although there's more to do
      in general.
      
      Change-Id: I8dfabe7b423b31a30e516cfdf005b62a2e9ccd82
      Reviewed-on: https://go-review.googlesource.com/20645Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      7c18f8cd
    • Dominik Honnef's avatar
      reflect: use SelectDir instead of uintptr in runtimeSelect · 368507bb
      Dominik Honnef authored
      And fix the wrong comment.
      
      Initially found this because the comment was wrong about the possible
      values. Then noticed that there doesn't seem to be any reason to use
      uintptr over SelectDir.
      
      Change-Id: I4f9f9640e49d89e558ed00bd99e57dab890785f5
      Reviewed-on: https://go-review.googlesource.com/20655Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      368507bb
    • Martin Möhrmann's avatar
      runtime: speed up growslice by avoiding divisions · 43ed65f8
      Martin Möhrmann authored
      Only compute the number of maximum allowed elements per slice once.
      Special case newcap computation for slices with byte sized elements.
      
      name              old time/op  new time/op  delta
      GrowSliceBytes-2  61.1ns ± 1%  43.4ns ± 1%  -29.00%  (p=0.000 n=20+20)
      GrowSliceInts-2   85.9ns ± 1%  75.7ns ± 1%  -11.80%  (p=0.000 n=20+20)
      
      Change-Id: I5d9c0d5987cdd108ac29dc32e31912dcefa2324d
      Reviewed-on: https://go-review.googlesource.com/20653Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      43ed65f8
    • Brad Fitzpatrick's avatar
      os/user: fix formatting of error group lookup message · b55a5dbb
      Brad Fitzpatrick authored
      It was failing like "unknown groupid ᎈ|" instead of "unknown groupid
      5000" due to the conversion from int to string.
      
      Updates #14806
      
      Change-Id: I83e4b478ff628ad4053573a9f32b3fadce22e847
      Reviewed-on: https://go-review.googlesource.com/20642Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      b55a5dbb
  2. 13 Mar, 2016 10 commits
  3. 12 Mar, 2016 13 commits
  4. 11 Mar, 2016 13 commits
    • Matthew Dempsky's avatar
      cmd/compile: move universe block code into new universe.go · 9d7b2b7b
      Matthew Dempsky authored
      Move lexinit, typeinit, lexinit1, and lexfini into new universe.go
      file, and give them a more idiomatic and descriptive API. No code
      changes.
      
      Change-Id: I0e9b25dcc86ad10f4b990dc02bd33477b488cc85
      Reviewed-on: https://go-review.googlesource.com/20604Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      9d7b2b7b
    • Robert Griesemer's avatar
      cmd/compile: move lexn and lexname into lex.go (cleanup) · 76461c93
      Robert Griesemer authored
      Missed these two declarations in the previous cleanup.
      
      Change-Id: I54ff3accd387dd90e12847daccf4477169797f81
      Reviewed-on: https://go-review.googlesource.com/20603
      Run-TryBot: Robert Griesemer <gri@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      76461c93
    • Robert Griesemer's avatar
      cmd/compile: move lexer into separate file (cleanup) · 998b6dd7
      Robert Griesemer authored
      This is really moving all the non-lexer pieces out of lex.go
      into main.go. It's always been confusing that the top-most
      compiler entry point (Main) is in the same file with the
      lexer. Both files remain of substantial size (> 1000 lines),
      which justifies this even more.
      
      No other changes.
      
      Change-Id: I03895589d5e3cc2340580350bbc1420539893dfc
      Reviewed-on: https://go-review.googlesource.com/20601
      Run-TryBot: Robert Griesemer <gri@golang.org>
      Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      998b6dd7
    • Robert Griesemer's avatar
      cmd/compile: simplify lexer.ungetr · e78ff382
      Robert Griesemer authored
      Change-Id: Id041c1b2d364aecd7a6613a53237f7de2c650a7e
      Reviewed-on: https://go-review.googlesource.com/20599
      Run-TryBot: Robert Griesemer <gri@golang.org>
      Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      e78ff382
    • David Crawshaw's avatar
      cmd/link: treat reflect.Value.Method like Call · e2836935
      David Crawshaw authored
      Fixes #14740
      
      Change-Id: Iad8d971c21977b0a1f4ef55a08bb180a8125e976
      Reviewed-on: https://go-review.googlesource.com/20562Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: David Crawshaw <crawshaw@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      e2836935
    • David Crawshaw's avatar
      cmd/compile: use bufio.Reader directly in lexer · 5aa5db75
      David Crawshaw authored
      Removes an intermediate layer of functions that was clogging up a
      corner of the compiler's profile graph.
      
      I can't measure a performance improvement running a large build
      like jujud, but the profile reports less total time spent in
      gc.(*lexer).getr.
      
      Change-Id: I3000585cfcb0f9729d3a3859e9023690a6528591
      Reviewed-on: https://go-review.googlesource.com/20565Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      Run-TryBot: David Crawshaw <crawshaw@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      5aa5db75
    • David Crawshaw's avatar
      cmd/compile: track reflect.Type.Method in deadcode · cc158403
      David Crawshaw authored
      In addition to reflect.Value.Call, exported methods can be invoked
      by the Func value in the reflect.Method struct. This CL has the
      compiler track what functions get access to a legitimate reflect.Method
      struct by looking for interface calls to either of:
      
      	Method(int) reflect.Method
      	MethodByName(string) (reflect.Method, bool)
      
      This is a little overly conservative. If a user implements a type
      with one of these methods without using the underlying calls on
      reflect.Type, the linker will assume the worst and include all
      exported methods. But it's cheap.
      
      No change to any of the binary sizes reported in cl/20483.
      
      For #14740
      
      Change-Id: Ie17786395d0453ce0384d8b240ecb043b7726137
      Reviewed-on: https://go-review.googlesource.com/20489Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
      cc158403
    • Josh Bleecher Snyder's avatar
      cmd/compile: improve go.importpath.* docs · 4112f0f7
      Josh Bleecher Snyder authored
      While we're here, remove a bit of dead code.
      
      Change-Id: I1344bb41e5d368825ca5748189382f9e7023c59a
      Reviewed-on: https://go-review.googlesource.com/20596
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      4112f0f7
    • Josh Bleecher Snyder's avatar
      cmd/link: tidy up rdsym · 2ac8555d
      Josh Bleecher Snyder authored
      Use an early return. Check errors. Deduplicate.
      
      Change-Id: Iabefd563b5ef82a16fab4791277630804fd09003
      Reviewed-on: https://go-review.googlesource.com/20597
      Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      2ac8555d
    • Matthew Dempsky's avatar
      cmd/compile: eliminate uses of Type.Down in bexport.go · de4317cb
      Matthew Dempsky authored
      Change-Id: I298b9d389ac33a24365f4c06a122c3af989906c0
      Reviewed-on: https://go-review.googlesource.com/20594
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      de4317cb
    • Matthew Dempsky's avatar
      cmd/compile: sort interface methods in tointerface0 · d9bb6939
      Matthew Dempsky authored
      Might as well sort them while they're still in a slice.
      
      Change-Id: I40c25ddc5c054dcb4da2aeefa79947967609d599
      Reviewed-on: https://go-review.googlesource.com/20591
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      d9bb6939
    • Klaus Post's avatar
      compress/flate: optimize huffman bit encoder · 53984e5b
      Klaus Post authored
      Part 1 of optimizing the deflater. This optimizes the bitwriter by:
      
      * Removing allocations.
      * Storing compound values for bit codes instead of 2 separate tables.
      * Accumulate 48 bits between writes instead of 24.
      * Inline bit flushing.
      
      This also contains code that will be used in later CL's
      (writeBlockDynamic, writeBlockHuff).
      
      Tests for Huffman bit writer encoding regressions has been added.
      
      name                       old speed      new speed      delta
      EncodeDigitsSpeed1e4-4     19.3MB/s ± 1%  21.6MB/s ± 1%  +11.77%
      EncodeDigitsSpeed1e5-4     25.0MB/s ± 6%  30.7MB/s ± 1%  +22.70%
      EncodeDigitsSpeed1e6-4     28.2MB/s ± 1%  32.3MB/s ± 1%  +14.64%
      EncodeDigitsDefault1e4-4   13.3MB/s ± 0%  14.2MB/s ± 1%   +7.07%
      EncodeDigitsDefault1e5-4   6.43MB/s ± 1%  6.64MB/s ± 1%   +3.27%
      EncodeDigitsDefault1e6-4   5.81MB/s ± 0%  5.85MB/s ± 1%   +0.69%
      EncodeDigitsCompress1e4-4  13.2MB/s ± 0%  14.4MB/s ± 0%   +9.10%
      EncodeDigitsCompress1e5-4  6.40MB/s ± 1%  6.61MB/s ± 0%   +3.20%
      EncodeDigitsCompress1e6-4  5.80MB/s ± 1%  5.90MB/s ± 1%   +1.64%
      EncodeTwainSpeed1e4-4      18.4MB/s ± 1%  20.7MB/s ± 1%  +12.72%
      EncodeTwainSpeed1e5-4      27.7MB/s ± 1%  31.0MB/s ± 1%  +11.78%
      EncodeTwainSpeed1e6-4      29.1MB/s ± 0%  32.9MB/s ± 2%  +13.25%
      EncodeTwainDefault1e4-4    12.4MB/s ± 0%  13.1MB/s ± 1%   +5.88%
      EncodeTwainDefault1e5-4    7.52MB/s ± 1%  7.83MB/s ± 0%   +4.19%
      EncodeTwainDefault1e6-4    7.08MB/s ± 1%  7.26MB/s ± 0%   +2.54%
      EncodeTwainCompress1e4-4   12.0MB/s ± 1%  12.8MB/s ± 1%   +6.70%
      EncodeTwainCompress1e5-4   5.96MB/s ± 1%  6.16MB/s ± 0%   +3.27%
      EncodeTwainCompress1e6-4   5.37MB/s ± 0%  5.39MB/s ± 1%   +0.47%
      
      >Allocations:
      
      benchmark                              old allocs     new allocs     delta
      BenchmarkEncodeDigitsSpeed1e4-4        50             0              -100.00%
      BenchmarkEncodeDigitsSpeed1e5-4        110            0              -100.00%
      BenchmarkEncodeDigitsSpeed1e6-4        1032           0              -100.00%
      BenchmarkEncodeDigitsDefault1e4-4      56             0              -100.00%
      BenchmarkEncodeDigitsDefault1e5-4      120            0              -100.00%
      BenchmarkEncodeDigitsDefault1e6-4      966            0              -100.00%
      BenchmarkEncodeDigitsCompress1e4-4     56             0              -100.00%
      BenchmarkEncodeDigitsCompress1e5-4     120            0              -100.00%
      BenchmarkEncodeDigitsCompress1e6-4     966            0              -100.00%
      BenchmarkEncodeTwainSpeed1e4-4         58             0              -100.00%
      BenchmarkEncodeTwainSpeed1e5-4         132            0              -100.00%
      BenchmarkEncodeTwainSpeed1e6-4         1082           0              -100.00%
      BenchmarkEncodeTwainDefault1e4-4       52             0              -100.00%
      BenchmarkEncodeTwainDefault1e5-4       126            0              -100.00%
      BenchmarkEncodeTwainDefault1e6-4       886            0              -100.00%
      BenchmarkEncodeTwainCompress1e4-4      52             0              -100.00%
      BenchmarkEncodeTwainCompress1e5-4      120            0              -100.00%
      BenchmarkEncodeTwainCompress1e6-4      880            0              -100.00%
      
      benchmark                              old bytes     new bytes     delta
      BenchmarkEncodeDigitsSpeed1e4-4        4288          2             -99.95%
      BenchmarkEncodeDigitsSpeed1e5-4        8896          15            -99.83%
      BenchmarkEncodeDigitsSpeed1e6-4        84098         153           -99.82%
      BenchmarkEncodeDigitsDefault1e4-4      4480          3             -99.93%
      BenchmarkEncodeDigitsDefault1e5-4      9216          76            -99.18%
      BenchmarkEncodeDigitsDefault1e6-4      73920         768           -98.96%
      BenchmarkEncodeDigitsCompress1e4-4     4480          3             -99.93%
      BenchmarkEncodeDigitsCompress1e5-4     9216          76            -99.18%
      BenchmarkEncodeDigitsCompress1e6-4     73920         768           -98.96%
      BenchmarkEncodeTwainSpeed1e4-4         4544          2             -99.96%
      BenchmarkEncodeTwainSpeed1e5-4         9600          15            -99.84%
      BenchmarkEncodeTwainSpeed1e6-4         77633         153           -99.80%
      BenchmarkEncodeTwainDefault1e4-4       4352          3             -99.93%
      BenchmarkEncodeTwainDefault1e5-4       9408          76            -99.19%
      BenchmarkEncodeTwainDefault1e6-4       65984         768           -98.84%
      BenchmarkEncodeTwainCompress1e4-4      4352          3             -99.93%
      BenchmarkEncodeTwainCompress1e5-4      9216          76            -99.18%
      BenchmarkEncodeTwainCompress1e6-4      65792         768           -98.83%
      
      Updates #14258
      
      Change-Id: Ibaa97b9619743ad623094727228eb2ada1ec7f1f
      Reviewed-on: https://go-review.googlesource.com/19336Reviewed-by: 's avatarNigel Tao <nigeltao@golang.org>
      Reviewed-by: 's avatarJoe Tsai <joetsai@digital-static.net>
      Run-TryBot: Joe Tsai <joetsai@digital-static.net>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      53984e5b
    • Klaus Post's avatar
      compress/flate: test if results are deterministic · afdb8cff
      Klaus Post authored
      This will test if deflate output is deterministic between two runs
      of the deflater, when write sizes differ.
      
      The deflater makes no official promises that results are
      deterministic between runs, but this is a good test to determine
      unintentional randomness.
      
      Note that this does not guarantee that results are deterministic
      across platforms nor that results will be deterministic between
      Go versions. This is also not guarantees we should imply.
      
      Change-Id: Id7dd89fe276060fd83a43d0b34ac35d50fcd32d9
      Reviewed-on: https://go-review.googlesource.com/20573Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      afdb8cff