1. 08 Sep, 2017 9 commits
    • Hiroshi Ioka's avatar
      cmd/internal/goobj: add tests · 87dae586
      Hiroshi Ioka authored
      Change-Id: I4a0fe1c8625e7e9adfd84ac6910da83d0268f928
      Reviewed-on: https://go-review.googlesource.com/60130Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      Run-TryBot: David Crawshaw <crawshaw@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      87dae586
    • Michael Munday's avatar
      cmd/compile: propagate constants through math.Float{32,64}{,from}bits · 9da29b68
      Michael Munday authored
      This CL adds generic SSA rules to propagate constants through raw bits
      conversions between floats and integers. This allows constants to
      propagate through some math functions. For example, math.Copysign(0, -1)
      is now constant folded to a load of -0.0.
      
      Requires a fix to the ARM assembler which loaded -0.0 as +0.0.
      
      Change-Id: I52649a4691077c7414f19d17bb599a6743c23ac2
      Reviewed-on: https://go-review.googlesource.com/62250
      Run-TryBot: Michael Munday <mike.munday@ibm.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
      9da29b68
    • Hiroshi Ioka's avatar
      cmd/go: don't write file if -n option is given · 4439b21d
      Hiroshi Ioka authored
      Change-Id: I01f5d3b4748d0ead8642ff3e53d1ae9c4378bcbc
      Reviewed-on: https://go-review.googlesource.com/61111Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      Run-TryBot: David Crawshaw <crawshaw@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      4439b21d
    • Davor Kapsa's avatar
      database/sql: fix Conn's doc typo · e16dc7d5
      Davor Kapsa authored
      Fixes #21798
      
      Change-Id: Ided31a8b22c220acdeb3938cac41ce8db9a110c3
      Reviewed-on: https://go-review.googlesource.com/62290Reviewed-by: 's avatarEmmanuel Odeke <emm.odeke@gmail.com>
      e16dc7d5
    • Josh Bleecher Snyder's avatar
      math/rand: make Perm match Shuffle · caae0917
      Josh Bleecher Snyder authored
      Perm and Shuffle are fundamentally doing the same work.
      This change makes Perm's algorithm match Shuffle's.
      In addition to allowing developers to switch more
      easily between the two methods, it affords a nice speed-up:
      
      name      old time/op  new time/op  delta
      Perm3-8   75.7ns ± 1%  51.8ns ± 1%  -31.59%  (p=0.000 n=9+8)
      Perm30-8   610ns ± 1%   405ns ± 1%  -33.67%  (p=0.000 n=9+9)
      
      This change alters the output from Perm,
      given the same Source and seed.
      This is a change from Go 1.0 behavior.
      This necessitates updating the regression test.
      
      This also changes the number of calls made to the Source
      during Perm, which changes the output of the math/rand examples.
      
      This also slightly perturbs the output of Perm,
      nudging it out of the range currently accepted by TestUniformFactorial.
      However, it is complete unclear that the helpers relied on
      by TestUniformFactorial are correct. That is #21211.
      This change updates checkSimilarDistribution to respect
      closeEnough for standard deviations, which makes the test pass.
      The whole situation is muddy; see #21211 for details.
      
      There is an alternative implementation of Perm
      that avoids initializing m, which is more similar
      to the existing implementation, plus some optimizations:
      
      func (r *Rand) Perm(n int) []int {
      	m := make([]int, n)
      	max31 := n
      	if n > 1<<31-1-1 {
      		max31 = 1<<31 - 1 - 1
      	}
      	i := 1
      	for ; i < max31; i++ {
      		j := r.int31n(int32(i + 1))
      		m[i] = m[j]
      		m[j] = i
      	}
      	for ; i < n; i++ {
      		j := r.Int63n(int64(i + 1))
      		m[i] = m[j]
      		m[j] = i
      	}
      	return m
      }
      
      This is a tiny bit faster than the implementation
      actually used in this change:
      
      name      old time/op  new time/op  delta
      Perm3-8   51.8ns ± 1%  50.3ns ± 1%  -2.83%  (p=0.000 n=8+9)
      Perm30-8   405ns ± 1%   394ns ± 1%  -2.66%  (p=0.000 n=9+8)
      
      However, 3% in performance doesn't seem worth
      having the two algorithms diverge,
      nor the reduced readability of this alternative.
      
      Updates #16213.
      
      Change-Id: I11a7441ff8837ee9c241b4c88f7aa905348be781
      Reviewed-on: https://go-review.googlesource.com/55972
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRob Pike <r@golang.org>
      caae0917
    • Josh Bleecher Snyder's avatar
      math/rand: add Shuffle · a2dfe5d2
      Josh Bleecher Snyder authored
      Shuffle uses the Fisher-Yates algorithm.
      
      Since this is new API, it affords us the opportunity
      to use a much faster Int31n implementation that mostly avoids division.
      As a result, BenchmarkPerm30ViaShuffle is
      about 30% faster than BenchmarkPerm30,
      despite requiring a separate initialization loop
      and using function calls to swap elements.
      
      Fixes #20480
      Updates #16213
      Updates #21211
      
      Change-Id: Ib8956c4bebed9d84f193eb98282ec16ee7c2b2d5
      Reviewed-on: https://go-review.googlesource.com/51891
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      a2dfe5d2
    • Cholerae Hu's avatar
      time: don't match '---' month in time.Parse · 32e117d9
      Cholerae Hu authored
      The existing implementation will panic when month in date string is '---'.
      
      Fixed #21113
      
      Change-Id: I8058ae7a4102e882f8b7e9c65d80936b563265e4
      Reviewed-on: https://go-review.googlesource.com/51010
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      32e117d9
    • Mayank Kumar's avatar
      path: add path.Dir example with trailing slash · a323656b
      Mayank Kumar authored
      Change-Id: I143203a9dcf9a4da0e53a3aab6e370244b849296
      Reviewed-on: https://go-review.googlesource.com/62270
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      a323656b
    • Kunpei Sakai's avatar
      net/http: make ServeMux preserve query string during redirects · ab401077
      Kunpei Sakai authored
      Ensure that the implicitly created redirect
      for
        "/route"
      after
        "/route/"
      has been registered doesn't lose the query string information.
      A previous attempt (https://golang.org/cl/43779) changed http.Redirect, however, that change broke direct calls to http.Redirect.
      To avoid that problem, this change touches ServeMux.Handler only.
      
      Fixes #17841
      
      Change-Id: I303c1b1824615304ae68147e254bb41b0ea339be
      Reviewed-on: https://go-review.googlesource.com/61210
      Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarTom Bergan <tombergan@google.com>
      Reviewed-by: 's avatarEmmanuel Odeke <emm.odeke@gmail.com>
      ab401077
  2. 07 Sep, 2017 5 commits
  3. 06 Sep, 2017 13 commits
  4. 05 Sep, 2017 7 commits
  5. 04 Sep, 2017 1 commit
  6. 03 Sep, 2017 4 commits
  7. 02 Sep, 2017 1 commit