1. 25 Mar, 2016 10 commits
    • Marcel van Lohuizen's avatar
      testing: probe with N=1 · 31e5d835
      Marcel van Lohuizen authored
      Change control flow to probe with N=1. This calls benchFunc
      the same number of times as the old implementation in the
      absence of subbenchmarks.
      
      To be compatible with existing tools, benchmarking only
      prints a line for "leaf" benchmarks. This means, though, that
      the name of a benchmark can only be printed after the first
      iteration.
      
      Issue #14863
      
      Change-Id: Ic7b9b89b058f8ebb5287755f24f9e47df8c9537c
      Reviewed-on: https://go-review.googlesource.com/21043
      Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      31e5d835
    • Marcel van Lohuizen's avatar
      cmd/go: update alldocs.go · 2e79d7fb
      Marcel van Lohuizen authored
      Also added go:generate directive.
      
      Change-Id: Ib1f0eddc75e3c47a4d904786a29b964a35b18456
      Reviewed-on: https://go-review.googlesource.com/21042Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
      2e79d7fb
    • Dominik Honnef's avatar
      all: delete dead non-test code · fdba5a75
      Dominik Honnef authored
      This change removes a lot of dead code. Some of the code has never been
      used, not even when it was first commited. The rest shouldn't have
      survived refactors.
      
      This change doesn't remove unused routines helpful for debugging, nor
      does it remove code that's used in commented out blocks of code that are
      only unused temporarily. Furthermore, unused constants weren't removed
      when they were part of a set of constants from specifications.
      
      One noteworthy omission from this CL are about 1000 lines of unused code
      in cmd/fix, 700 lines of which are the typechecker, which hasn't been
      used ever since the pre-Go 1 fixes have been removed. I wasn't sure if
      this code should stick around for future uses of cmd/fix or be culled as
      well.
      
      Change-Id: Ib714bc7e487edc11ad23ba1c3222d1fd02e4a549
      Reviewed-on: https://go-review.googlesource.com/20926Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      fdba5a75
    • Dmitry Chestnykh's avatar
      crypto/hmac: simplify implementation · 6a6a0734
      Dmitry Chestnykh authored
      Store already padded keys instead of storing key and padding it during
      Reset and Sum. This simplifies code and makes Reset-Write-Sum sequences
      faster, which helps /x/crypto/pbkdf2.
      
      HMAC benchmark:
      
      benchmark                    old ns/op     new ns/op     delta
      BenchmarkHMACSHA256_1K-4     7669          7613          -0.73%
      BenchmarkHMACSHA256_32-4     1880          1737          -7.61%
      
      benchmark                    old MB/s     new MB/s     speedup
      BenchmarkHMACSHA256_1K-4     133.52       134.50       1.01x
      BenchmarkHMACSHA256_32-4     17.02        18.41        1.08x
      
      PBKDF2 benchmark:
      
      benchmark                       old ns/op     new ns/op     delta
      BenchmarkPBKDF2HMACSHA256-4     1943196       1807699       -6.97%
      
      Change-Id: I6697028370c226715ab477b0844951a83eb3488c
      Reviewed-on: https://go-review.googlesource.com/21024
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAdam Langley <agl@golang.org>
      6a6a0734
    • John Jeffery's avatar
      reflect: add method StructTag.Lookup · 5c8674a4
      John Jeffery authored
      The Lookup method provides a way to extract a tag value, while
      determining whether the tag key exists in the struct field's tag.
      
      Fixes #14883
      
      Change-Id: I7460cb68f0ca1aaa025935050b9e182efcb64db3
      Reviewed-on: https://go-review.googlesource.com/20864Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      5c8674a4
    • Caleb Spare's avatar
      all: zero mtimes in testdata gz files · 139fad21
      Caleb Spare authored
      Fixes #14937.
      
      Change-Id: Iea11a32230d44d5a43f8aec812d25f13bce85895
      Reviewed-on: https://go-review.googlesource.com/21038Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      139fad21
    • Caleb Spare's avatar
      encoding/json: add (*Encoder).Indent · 098b6264
      Caleb Spare authored
      Fixes #6492.
      
      Change-Id: Ibc633c43a6d134bb140addb59780a5758b35a5c5
      Reviewed-on: https://go-review.googlesource.com/21057
      Run-TryBot: Caleb Spare <cespare@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      098b6264
    • Elias Naur's avatar
      cmd/go: remove limits on parallel tasks in the Go command for iOS · ba333a30
      Elias Naur authored
      Ther darwin/arm{,64} exec wrapper now limits the number of concurrent
      executions to 1, so remove the higher level parallel task limit from
      the Go command.
      
      Change-Id: Id84f65c3908305bde0452b3c8db6df8c5a8881bb
      Reviewed-on: https://go-review.googlesource.com/21100Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
      ba333a30
    • Elias Naur's avatar
      misc/cgo/testcarchive: fix build · 95add73a
      Elias Naur authored
      I failed to rebase (and re-test) CL 21102 before submit, which meant
      that two extra tests sneaked into testcarchive that still referenced
      runtime.GOOS and runtime.GOARCH.
      
      Convert the new tests.
      
      While we're here, make sure pending tasks are flushed before running
      the host tests. If not, the "##### misc/cgo/testcarchive" banner
      and "PASS" won't show up in the all.bash output.
      
      Change-Id: I41fc4ec9515f9a193fa052f7c31fac452153c897
      Reviewed-on: https://go-review.googlesource.com/21106
      Run-TryBot: Elias Naur <elias.naur@gmail.com>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      95add73a
    • David Crawshaw's avatar
      cmd/compile, runtime: new static name encoding · 24ce64d1
      David Crawshaw authored
      Create a byte encoding designed for static Go names.
      
      It is intended to be a compact representation of a name
      and optional tag data that can be turned into a Go string
      without allocating, and describes whether or not it is
      exported without unicode table.
      
      The encoding is described in reflect/type.go:
      
      // The first byte is a bit field containing:
      //
      //	1<<0 the name is exported
      //	1<<1 tag data follows the name
      //	1<<2 pkgPath *string follow the name and tag
      //
      // The next two bytes are the data length:
      //
      //	 l := uint16(data[1])<<8 | uint16(data[2])
      //
      // Bytes [3:3+l] are the string data.
      //
      // If tag data follows then bytes 3+l and 3+l+1 are the tag length,
      // with the data following.
      //
      // If the import path follows, then ptrSize bytes at the end of
      // the data form a *string. The import path is only set for concrete
      // methods that are defined in a different package than their type.
      
      Shrinks binary sizes:
      
      	cmd/go: 164KB (1.6%)
      	jujud:  1.0MB (1.5%)
      
      For #6853.
      
      Change-Id: I46b6591015b17936a443c9efb5009de8dfe8b609
      Reviewed-on: https://go-review.googlesource.com/20968
      Run-TryBot: David Crawshaw <crawshaw@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      24ce64d1
  2. 24 Mar, 2016 20 commits
  3. 23 Mar, 2016 10 commits
    • Brad Fitzpatrick's avatar
      net/http/httptest: add NewRequest helper for ease of testing handlers · 694eadcc
      Brad Fitzpatrick authored
      Fixes #14199
      
      Change-Id: Ic9284023b663de3db1ca7b7b1e96eeab82ec0944
      Reviewed-on: https://go-review.googlesource.com/21016
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarAndrew Gerrand <adg@golang.org>
      694eadcc
    • Marvin Stenger's avatar
      cmd/compile: prettify loop iterations · bd83cc6d
      Marvin Stenger authored
      This commit replaces some of
      
      for i := len(x) - 1; i >= 0; i-- {...}
      
      style loops, which do not rely on reverse iteration order.
      
      Change-Id: I5542834286562da058200c06e7a173b13760e54d
      Reviewed-on: https://go-review.googlesource.com/21044Reviewed-by: default avatarKeith Randall <khr@golang.org>
      bd83cc6d
    • Brad Fitzpatrick's avatar
      cmd/compile: reduce some SSA garbage · ca5417b8
      Brad Fitzpatrick authored
      It's pretty hard to get reliable CPU numbers, even with 50 runs on an
      otherwise-idle physical Linux machine, but the garbage reduction
      numbers are nice. To get useful time/op numbers, I modified
      compilebench to report user CPU time instead of wall time:
      
      name       old time/op     new time/op     delta
      Template       547ms ± 6%      557ms ± 5%   +1.80%        (p=0.001 n=49+49)
      Unicode        360ms ± 9%      365ms ± 6%     ~           (p=0.094 n=50+45)
      GoTypes        1.84s ± 3%      1.82s ± 3%   -1.50%        (p=0.000 n=50+49)
      Compiler       9.19s ± 2%      9.02s ± 2%   -1.87%        (p=0.000 n=45+50)
      
      name       old alloc/op    new alloc/op    delta
      Template      63.3MB ± 0%     59.1MB ± 0%   -6.72%        (p=0.000 n=50+50)
      Unicode       43.1MB ± 0%     42.9MB ± 0%   -0.47%        (p=0.000 n=50+49)
      GoTypes        220MB ± 0%      200MB ± 0%   -9.00%        (p=0.000 n=50+50)
      Compiler      1.00GB ± 0%     0.89GB ± 0%  -10.09%        (p=0.000 n=50+49)
      
      name       old allocs/op   new allocs/op   delta
      Template        681k ± 0%       680k ± 0%   -0.16%        (p=0.000 n=50+48)
      Unicode         541k ± 0%       541k ± 0%   -0.02%        (p=0.011 n=48+50)
      GoTypes        2.08M ± 0%      2.08M ± 0%   -0.19%        (p=0.000 n=48+50)
      Compiler       9.24M ± 0%      9.23M ± 0%   -0.11%        (p=0.000 n=50+50)
      
      Change-Id: I1fac4ebf85a1783e3289c3ffb1ed365442837643
      Reviewed-on: https://go-review.googlesource.com/20995
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDave Cheney <dave@cheney.net>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      ca5417b8
    • Matthew Dempsky's avatar
      cmd/compile: small Mpint method simplifications · 0659cf69
      Matthew Dempsky authored
      Get rid of (*Mpint).Add's "quiet" parameter: it's always set to 0.
      
      Inline (*Mpint).shift into (*Mpint).Lsh and (*Mpint).Rsh. There's no
      need for a common shift method that can handle both left or right
      shifts based on sign when the higher level abstractions only ever do
      one or the other.
      
      Change-Id: Icd3b082413f9193961b6835279e0bd4b6a6a6621
      Reviewed-on: https://go-review.googlesource.com/21050
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      0659cf69
    • Keith Randall's avatar
      cmd/compile: start on ARM port · 4c9a470d
      Keith Randall authored
      Start working on arm port.  Gets close to correct
      code for fibonacci:
          func fib(n int) int {
              if n < 2 {
                  return n
              }
              return fib(n-1) + fib(n-2)
          }
      
      Still a lot to do, but this is a good starting point.
      
      Cleaned up some arch-specific dependencies in regalloc.
      
      Change-Id: I4301c6c31a8402168e50dcfee8bcf7aee73ea9d5
      Reviewed-on: https://go-review.googlesource.com/21000Reviewed-by: default avatarDavid Chase <drchase@google.com>
      4c9a470d
    • David Crawshaw's avatar
      cmd/link, reflect: remove some method type data · 44d3f89e
      David Crawshaw authored
      Remove reflect type information for unexported methods that do not
      satisfy any interface in the program.
      
      Ideally the unexported method would not appear in the method list at
      all, but that is tricky because the slice is built by the compiler.
      
      Reduces binary size:
      
      	cmd/go: 81KB (0.8%)
      	jujud: 258KB (0.4%)
      
      For #6853.
      
      Change-Id: I25ef8df6907e9ac03b18689d584ea46e7d773043
      Reviewed-on: https://go-review.googlesource.com/21033Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      Run-TryBot: David Crawshaw <crawshaw@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      44d3f89e
    • Alexandru Moșoi's avatar
      cmd/compile: don't simplify nilchecks in loops · c1892b9c
      Alexandru Moșoi authored
      khr: Lifting the nil check out of the loop altogether is an admirable
      goal, and this rewrite is one step on the way. But without lifting it
      out of the loop, the rewrite is just hurting us.
      
      Fixes #14917
      
      Change-Id: Idb917f37d89f50f8e046d5ebd7c092b1e0eb0633
      Reviewed-on: https://go-review.googlesource.com/21040Reviewed-by: default avatarKeith Randall <khr@golang.org>
      Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      c1892b9c
    • Lynn Boger's avatar
      bytes: Equal perf improvements on ppc64le/ppc64 · baec1487
      Lynn Boger authored
      The existing implementation for Equal and similar
      functions in the bytes package operate on one byte at
      at time.  This performs poorly on ppc64/ppc64le especially
      when the byte buffers are large.  This change improves
      those functions by loading and comparing double words where
      possible.  The common code has been moved to a function
      that can be shared by the other functions in this
      file which perform the same type of comparison.
      Further optimizations are done for the case where
      >= 32 bytes are being compared.  The new function
      memeqbody is used by memeq_varlen, Equal, and eqstring.
      
      When running the bytes test with -test.bench=Equal
      
      benchmark                     old MB/s     new MB/s     speedup
      BenchmarkEqual1               164.83       129.49       0.79x
      BenchmarkEqual6               563.51       445.47       0.79x
      BenchmarkEqual9               656.15       1099.00      1.67x
      BenchmarkEqual15              591.93       1024.30      1.73x
      BenchmarkEqual16              613.25       1914.12      3.12x
      BenchmarkEqual20              682.37       1687.04      2.47x
      BenchmarkEqual32              807.96       3843.29      4.76x
      BenchmarkEqual4K              1076.25      23280.51     21.63x
      BenchmarkEqual4M              1079.30      13120.14     12.16x
      BenchmarkEqual64M             1073.28      10876.92     10.13x
      
      It was determined that the degradation in the smaller byte tests
      were due to unfavorable code alignment of the single byte loop.
      
      Fixes #14368
      
      Change-Id: I0dd87382c28887c70f4fbe80877a8ba03c31d7cd
      Reviewed-on: https://go-review.googlesource.com/20249Reviewed-by: default avatarMinux Ma <minux@golang.org>
      baec1487
    • Shahar Kohanim's avatar
      cmd/link: Clean up Pcln struct · 516c6b40
      Shahar Kohanim authored
      Removes unnecessary fields from Pcln.
      
      Change-Id: I175049ca749b510eedaf65162355bc4d7a93315e
      Reviewed-on: https://go-review.googlesource.com/21041Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
      516c6b40
    • Klaus Post's avatar
      compress/flate: rework matching algorithm · 53efe1e1
      Klaus Post authored
      This changes how matching is done in deflate algorithm.
      
      The major change is that we do not look for matches that are only
      3 bytes in length, matches must be 4 bytes at least.
      Contrary to what you would expect this actually improves the
      compresion ratio, since 3 literal bytes will often be shorter
      than a match after huffman encoding.
      This varies a bit by source, but is most often the case when the
      source is "easy" to compress.
      
      Second of all, a "stronger" hash is used. The hash is similar to
      the hashing function used by Snappy.
      
      Overall, the speed impact is biggest on higher compression levels.
      I intend to replace the "speed" compression level, which can be
      seen in CL 21021.
      
      The built-in benchmark using "digits" is slower at level 1.
      I see this as an exception, since "digits" is a special type
      of data, where you have low entropy (numbers 0->9), but no
      significant matches. Again, CL 20021 fixes that case.
      
      NewWriterDict is also made considerably faster, by not running data
      through the entire encoder. This is not reflected by the benchmark.
      
      Overall, the speed impact is biggest on higher compression levels.
      I intend to replace the "speed" compression level.
      
      COMPARED to tip/master:
      name                       old time/op    new time/op     delta
      EncodeDigitsSpeed1e4-4        401µs ± 1%      345µs ± 2%   -13.95%
      EncodeDigitsSpeed1e5-4       3.19ms ± 1%     4.27ms ± 3%   +33.96%
      EncodeDigitsSpeed1e6-4       27.7ms ± 4%     43.8ms ± 3%   +58.00%
      EncodeDigitsDefault1e4-4      641µs ± 0%      403µs ± 1%   -37.15%
      EncodeDigitsDefault1e5-4     13.8ms ± 1%      6.4ms ± 3%   -53.73%
      EncodeDigitsDefault1e6-4      162ms ± 1%       64ms ± 2%   -60.51%
      EncodeDigitsCompress1e4-4     627µs ± 1%      405µs ± 2%   -35.45%
      EncodeDigitsCompress1e5-4    13.9ms ± 0%      6.3ms ± 2%   -54.46%
      EncodeDigitsCompress1e6-4     159ms ± 1%       64ms ± 0%   -59.91%
      EncodeTwainSpeed1e4-4         433µs ± 4%      331µs ± 1%   -23.53%
      EncodeTwainSpeed1e5-4        2.82ms ± 1%     3.08ms ± 0%    +9.10%
      EncodeTwainSpeed1e6-4        28.1ms ± 2%     28.8ms ± 0%    +2.82%
      EncodeTwainDefault1e4-4       695µs ± 4%      474µs ± 1%   -31.78%
      EncodeTwainDefault1e5-4      11.8ms ± 0%      7.4ms ± 0%   -37.31%
      EncodeTwainDefault1e6-4       128ms ± 0%       75ms ± 0%   -40.93%
      EncodeTwainCompress1e4-4      719µs ± 3%      480µs ± 0%   -33.27%
      EncodeTwainCompress1e5-4     15.0ms ± 3%      8.2ms ± 2%   -45.55%
      EncodeTwainCompress1e6-4      170ms ± 0%       85ms ± 1%   -49.99%
      
      name                       old speed      new speed       delta
      EncodeDigitsSpeed1e4-4     25.0MB/s ± 1%   29.0MB/s ± 2%   +16.24%
      EncodeDigitsSpeed1e5-4     31.4MB/s ± 1%   23.4MB/s ± 3%   -25.34%
      EncodeDigitsSpeed1e6-4     36.1MB/s ± 4%   22.8MB/s ± 3%   -36.74%
      EncodeDigitsDefault1e4-4   15.6MB/s ± 0%   24.8MB/s ± 1%   +59.11%
      EncodeDigitsDefault1e5-4   7.27MB/s ± 1%  15.72MB/s ± 3%  +116.23%
      EncodeDigitsDefault1e6-4   6.16MB/s ± 0%  15.60MB/s ± 2%  +153.25%
      EncodeDigitsCompress1e4-4  15.9MB/s ± 1%   24.7MB/s ± 2%   +54.97%
      EncodeDigitsCompress1e5-4  7.19MB/s ± 0%  15.78MB/s ± 2%  +119.62%
      EncodeDigitsCompress1e6-4  6.27MB/s ± 1%  15.65MB/s ± 0%  +149.52%
      EncodeTwainSpeed1e4-4      23.1MB/s ± 4%   30.2MB/s ± 1%   +30.68%
      EncodeTwainSpeed1e5-4      35.4MB/s ± 1%   32.5MB/s ± 0%    -8.34%
      EncodeTwainSpeed1e6-4      35.6MB/s ± 2%   34.7MB/s ± 0%    -2.77%
      EncodeTwainDefault1e4-4    14.4MB/s ± 4%   21.1MB/s ± 1%   +46.48%
      EncodeTwainDefault1e5-4    8.49MB/s ± 0%  13.55MB/s ± 0%   +59.50%
      EncodeTwainDefault1e6-4    7.83MB/s ± 0%  13.25MB/s ± 0%   +69.19%
      EncodeTwainCompress1e4-4   13.9MB/s ± 3%   20.8MB/s ± 0%   +49.83%
      EncodeTwainCompress1e5-4   6.65MB/s ± 3%  12.20MB/s ± 2%   +83.51%
      EncodeTwainCompress1e6-4   5.88MB/s ± 0%  11.76MB/s ± 1%  +100.06%
      
      Change-Id: I724e33c1dd3e3a6a1b0a68e094baa959352baf32
      Reviewed-on: https://go-review.googlesource.com/20929
      Run-TryBot: Nigel Tao <nigeltao@golang.org>
      Reviewed-by: default avatarNigel Tao <nigeltao@golang.org>
      53efe1e1