1. 28 Feb, 2016 4 commits
  2. 27 Feb, 2016 11 commits
    • Ian Lance Taylor's avatar
      cmd/cgo: recognize known C typedefs as types · 71cc445c
      Ian Lance Taylor authored
      Fixes #14483.
      
      Change-Id: I0cddfe27fd8d00ba85659d0b618410e39ebf45cb
      Reviewed-on: https://go-review.googlesource.com/19860Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      71cc445c
    • Ian Lance Taylor's avatar
      cmd/compile: change Func.Cvars to the new Nodes type · 922ce58d
      Ian Lance Taylor authored
      Update #14473.
      
      Change-Id: Iba1ecf42d9ab5a93144941439d5cc6b0b4f4a3ac
      Reviewed-on: https://go-review.googlesource.com/19992Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      922ce58d
    • Martin Möhrmann's avatar
      fmt: simplify buffer write methods and adjust calls to them · 7da4cedd
      Martin Möhrmann authored
      Once upon a time fmt did use bytes.Buffer for its buffer.
      The buffer write methods still mimic the bytes.Buffer signatures.
      The current code depends on manipulating the buffer []bytes array directly
      which makes going back to bytes.Buffer by only changing the type of buffer
      impossible. Since type buffer is not exported the methods can be simplified
      to the needs of fmt. This saves space and avoids unnecessary overhead.
      
      Use WriteString instead of Write for known inputs since
      WriteString is faster than Write to append the same data.
      This also saves space in the binary.
      
      Remove the add method from Printer and depending on the data to be written
      use WriteRune or WriteByte directly instead.
      
      In total makes the go binary around 4 kilobyte smaller.
      
      name                  old time/op  new time/op  delta
      SprintfEmpty-2        24.1ns ± 3%  23.8ns ± 1%  -1.14%  (p=0.000 n=20+20)
      SprintfString-2        114ns ± 2%   114ns ± 4%    ~     (p=0.558 n=20+19)
      SprintfInt-2           116ns ± 9%   118ns ± 7%    ~     (p=0.086 n=20+20)
      SprintfIntInt-2        195ns ± 6%   193ns ± 5%    ~     (p=0.345 n=20+19)
      SprintfPrefixedInt-2   251ns ±16%   241ns ± 9%  -3.69%  (p=0.024 n=20+19)
      SprintfFloat-2         203ns ± 4%   205ns ± 5%    ~     (p=0.153 n=20+20)
      SprintfBoolean-2       101ns ± 7%    96ns ±11%  -5.23%  (p=0.005 n=19+20)
      ManyArgs-2             651ns ± 7%   628ns ± 7%  -3.44%  (p=0.002 n=20+20)
      FprintInt-2            164ns ± 2%   158ns ± 2%  -3.62%  (p=0.000 n=20+18)
      FprintfBytes-2         215ns ± 1%   216ns ± 1%  +0.58%  (p=0.000 n=20+20)
      FprintIntNoAlloc-2     115ns ± 0%   112ns ± 0%  -2.61%  (p=0.000 n=20+20)
      ScanInts-2             700µs ± 0%   702µs ± 1%  +0.38%  (p=0.000 n=18+20)
      ScanRecursiveInt-2    82.7ms ± 0%  82.7ms ± 0%    ~     (p=0.820 n=20+20)
      
      Change-Id: I0409eb170b8a26d9f4eb271f6292e5d39faf2d8b
      Reviewed-on: https://go-review.googlesource.com/19955Reviewed-by: default avatarRob Pike <r@golang.org>
      7da4cedd
    • Justin Nuß's avatar
      strconv: Avoid allocation in AppendQuote* · 9d73a6dc
      Justin Nuß authored
      The current implementations of the AppendQuote functions use quoteWith
      (through Quote) for quoting the given value and appends the returned
      string to the dst byte slice. quoteWith internally creates a byte slice
      on each call which gets converted to a string in Quote.
      
      This means the AppendQuote functions always allocates a new byte slice
      and a string only to append them to an existing byte slice. In the case
      of (Append)QuoteRune the string passed to quoteWith will also needs to
      be allocated from a rune first.
      
      Split quoteWith into two functions (quoteWith and appendQuotedWith) and
      replace the call to Quote inside AppendQuote with appendQuotedWith,
      which appends directly to the byte slice passed to AppendQuote and also
      avoids the []byte->string conversion.
      
      Also introduce the 2 functions quoteRuneWith and appendQuotedRuneWith
      that work the same way as quoteWith and appendQuotedWith, but take a
      single rune instead of a string, to avoid allocating a new string when
      appending a single rune, and use them in (Append)QuoteRune.
      
      Also update the ToASCII and ToGraphic variants to use the new functions.
      
      Benchmark results:
      
      benchmark                      old ns/op     new ns/op     delta
      BenchmarkQuote-8               428           503           +17.52%
      BenchmarkQuoteRune-8           148           105           -29.05%
      BenchmarkAppendQuote-8         435           307           -29.43%
      BenchmarkAppendQuoteRune-8     158           23.5          -85.13%
      
      benchmark                      old allocs     new allocs     delta
      BenchmarkQuote-8               3              3              +0.00%
      BenchmarkQuoteRune-8           3              2              -33.33%
      BenchmarkAppendQuote-8         3              0              -100.00%
      BenchmarkAppendQuoteRune-8     3              0              -100.00%
      
      benchmark                      old bytes     new bytes     delta
      BenchmarkQuote-8               144           144           +0.00%
      BenchmarkQuoteRune-8           16            16            +0.00%
      BenchmarkAppendQuote-8         144           0             -100.00%
      BenchmarkAppendQuoteRune-8     16            0             -100.00%
      
      Change-Id: I77c148d5c7242f1b0edbbeeea184878abb51a522
      Reviewed-on: https://go-review.googlesource.com/18962
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      9d73a6dc
    • Mikio Hara's avatar
      crypto/tls: don't send IPv6 literals and absolute FQDNs as SNI values · f3f920ff
      Mikio Hara authored
      This is a followup change to #13111 for filtering out IPv6 literals and
      absolute FQDNs from being as the SNI values.
      
      Updates #13111.
      Fixes #14404.
      
      Change-Id: I09ab8d2a9153d9a92147e57ca141f2e97ddcef6e
      Reviewed-on: https://go-review.googlesource.com/19704Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      f3f920ff
    • Martin Möhrmann's avatar
      fmt: change padding functions to avoid package init · abcad1e5
      Martin Möhrmann authored
      Move the decision if zero padding is allowed to doPrintf
      where the other formatting decisions are made.
      
      Removes some dead code for negative f.wid that was never used
      due to f.wid always being positive and f.minus deciding if left
      or right padding should be used.
      
      New padding code writes directly into the buffer and is as fast
      as the old version but avoids the cost of needing package init.
      
      name              old time/op  new time/op  delta
      SprintfPadding-2   246ns ± 5%   245ns ± 4%   ~     (p=0.345 n=50+47)
      
      Change-Id: I7dfddbac8e328f4ef0cdee8fafc0d06c784b2711
      Reviewed-on: https://go-review.googlesource.com/19957
      Run-TryBot: Rob Pike <r@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRob Pike <r@golang.org>
      abcad1e5
    • Matthew Dempsky's avatar
      cmd/compile: remove unneeded test binary · 8b96bc68
      Matthew Dempsky authored
      Accidentally added in https://golang.org/cl/19968.
      
      Change-Id: Id70917c4d1f69db149688d797c90a19557d16f72
      Reviewed-on: https://go-review.googlesource.com/19985Reviewed-by: default avatarMinux Ma <minux@golang.org>
      8b96bc68
    • David du Colombier's avatar
      debug/gosym: fix TestPCLine on Plan 9 · ccf39a23
      David du Colombier authored
      Plan 9 doesn't define main, so the INITENTRY
      symbol remains with the SXREF type, which leads
      Entryvalue to fail on "entry not text: main".
      
      Fixes #14536.
      
      Change-Id: Id9b7d61e5c2202aba3ec9cd52f5b56e0a38f7c47
      Reviewed-on: https://go-review.googlesource.com/19973
      Run-TryBot: David du Colombier <0intro@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      ccf39a23
    • Brad Fitzpatrick's avatar
      doc: go1.7.txt updates · 31f2ed2c
      Brad Fitzpatrick authored
      Change-Id: I6ac3d11ee8896f636235fe10c2556f93584019b5
      Reviewed-on: https://go-review.googlesource.com/19984Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      31f2ed2c
    • Matthew Dempsky's avatar
      cmd/compile: simplify lexinit and lexfini · 52f099c4
      Matthew Dempsky authored
      Split the syms array into separate basicTypes and builtinFuncs arrays.
      
      Also, in lexfini, instead of duplicating the code from lexinit to
      declare the builtin identifiers in the user package, just import them
      from builtinpkg like how importdot works.
      
      Change-Id: Ic3b3b454627a46f7bd5f290d0e31443e659d431f
      Reviewed-on: https://go-review.googlesource.com/19936
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      52f099c4
    • Ian Lance Taylor's avatar
      cmd/compile: change Func.{Enter,Exit} from NodeList to slice · 188e3d25
      Ian Lance Taylor authored
      Introduces a new types Nodes that can be used to replace NodeList.
      
      Update #14473.
      
      Change-Id: Id77c5dcae0cbeb898ba12dd46bd400aad408871c
      Reviewed-on: https://go-review.googlesource.com/19969Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      188e3d25
  3. 26 Feb, 2016 25 commits