1. 16 Nov, 2017 4 commits
  2. 15 Nov, 2017 31 commits
    • Troels Thomsen's avatar
      net: Forget lookups for canceled contexts · 6a3d4be3
      Troels Thomsen authored
      A sequential lookup using any non-canceled context has a risk of
      returning the result of the previous lookup for a canceled context (i.e.
      an error).
      
      This is already prevented for timed out context by forgetting the host
      immediately and extending this to also compare the error to
      `context.Canceled` resolves this issue.
      
      Fixes #22724
      
      Change-Id: I7aafa1459a0de4dc5c4332988fbea23cbf4dba07
      Reviewed-on: https://go-review.googlesource.com/77670
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      6a3d4be3
    • Russ Cox's avatar
      archive/zip: fix handling of replacement rune in UTF8 check · 3a181dc7
      Russ Cox authored
      The replacement rune is a valid rune and can appear as itself in valid UTF8
      (it encodes as three bytes). To check for invalid UTF8 it is necessary to
      look for utf8.DecodeRune returning the replacement rune and size==1.
      
      Change-Id: I169be8d1fe61605c921ac13cc2fde94f80f3463c
      Reviewed-on: https://go-review.googlesource.com/78126
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarJoe Tsai <thebrokentoaster@gmail.com>
      3a181dc7
    • Russ Cox's avatar
      api: update next.txt · 7de9e5e1
      Russ Cox authored
      Change-Id: I540bdabe8ffda4697315fa6f09ad710c05b4a94d
      Reviewed-on: https://go-review.googlesource.com/78134
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      7de9e5e1
    • Russ Cox's avatar
      database/sql: fix ctx.Done() == nil check · b9dca1b1
      Russ Cox authored
      ctx.Done() == ctx.Background().Done() is just
      a long way to write ctx.Done() == nil.
      Use the short way.
      
      Change-Id: I7b3198b5dc46b8b40086243aa61882bc8c268eac
      Reviewed-on: https://go-review.googlesource.com/78128
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      b9dca1b1
    • Russ Cox's avatar
      database/sql/driver: rename ResetSessioner to SessionResetter · 442d15ab
      Russ Cox authored
      Originally we tried the strict -er suffix as the rule in this case
      but eventually we decided it was too awkward: io.WriteByter
      became io.ByteWriter. By analogy, here the interface should be
      named SessionResetter instead of the awkward ResetSessioner.
      
      This change should not affect any drivers that have already
      implemented the interface, because the method name is not changing.
      
      (This was added during the Go 1.10 cycle and has not been
      released yet, so we can change it.)
      
      Change-Id: Ie50e4e090d3811f85965da9da37d966e9f45e79d
      Reviewed-on: https://go-review.googlesource.com/78127
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarDaniel Theophanes <kardianos@gmail.com>
      442d15ab
    • Russ Cox's avatar
      net/mail: clarify doc comment · cac334cc
      Russ Cox authored
      Rewrite the text added in CL 50911, which I did not understand.
      
      Change-Id: Id6271ffe2f7c8833dd7733fe0254fa4927fac150
      Reviewed-on: https://go-review.googlesource.com/78124
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      cac334cc
    • Russ Cox's avatar
      io: document and test MultiWriter error behavior · e671a552
      Russ Cox authored
      MultiWriter(w1, w2) only writes to w2 if w1.Write succeeds.
      I did not know this, and it was not documented.
      Document and test.
      
      Change-Id: Idec2e8444d5a7aca0b95d07814a28daa454eb1d3
      Reviewed-on: https://go-review.googlesource.com/78123
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarJoe Tsai <thebrokentoaster@gmail.com>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      e671a552
    • Russ Cox's avatar
      encoding/xml: move unexported const out of exported const block · 894869e1
      Russ Cox authored
      CL 58210 introduced this constant for reasons I don't understand.
      It should not be in the exported const block, which will pollute
      godoc output with a "... unexported" notice.
      
      Also since we already have a constant named xmlnsPrefix for "xmlns",
      it is very confusing to also have xmlNamespacePrefix for "xml".
      If we must have the constant at all, rename it to xmlPrefix.
      
      Change-Id: I15f937454d730005816fcd32b1acca703acf1e51
      Reviewed-on: https://go-review.googlesource.com/78121
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      894869e1
    • Russ Cox's avatar
      encoding/csv: rename ParseError.RecordLine to .StartLine · c4c3f2a1
      Russ Cox authored
      A record can span multiple lines (the whole reason for the extra field),
      so the important fact is that it's the _start_ of the record.
      Make that clear in the name.
      
      (This API was added during the Go 1.10 cycle so it can still be cleaned up.)
      
      Change-Id: Id95b3ceb7cdfc4aa0ed5a053cb84da8945fa5496
      Reviewed-on: https://go-review.googlesource.com/78119
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: 's avatarJoe Tsai <thebrokentoaster@gmail.com>
      c4c3f2a1
    • Russ Cox's avatar
      encoding/binary: make new example a bit more idiomatic · 9232a612
      Russ Cox authored
      Mainly get rid of the weird zero-value struct literal,
      but while we're here also group and order things a bit better:
      first the reader, then the data, then the call (which takes reader then data).
      
      Change-Id: I901b0661d85d8eaa0807e4482aac66500ca996c7
      Reviewed-on: https://go-review.googlesource.com/78118
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarJoe Tsai <thebrokentoaster@gmail.com>
      9232a612
    • Russ Cox's avatar
      doc/contrib.html: add Go 1.10 to release list · 4f6035ae
      Russ Cox authored
      Apparently we maintain this list by hand (for example, CL 52351).
      
      Change-Id: I0a0b346cf2b7b547729cb1d0fa1642de447f7bba
      Reviewed-on: https://go-review.googlesource.com/78117
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      4f6035ae
    • Russ Cox's avatar
      cmd/dist: adjust package doc · f1966de6
      Russ Cox authored
      Mainly capitalize the first letter.
      (Followup to CL 54351.)
      
      Change-Id: I2d5c3d72c53d3468de7a9d4af8bd009182ff3d38
      Reviewed-on: https://go-review.googlesource.com/78114
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      f1966de6
    • Russ Cox's avatar
      bytes, strings: restore O(1) behavior of IndexAny(s, "") and LastIndexAny(s, "") · 2a166c93
      Russ Cox authored
      CL 65851 (bytes) and CL 65910 (strings) “improve[d] readability”
      by removing the special case that bypassed the whole function body
      when chars == "". In doing so, yes, the function was unindented a
      level, which is nice, but the runtime of that case went from O(1) to O(n)
      where n = len(s).
      
      I don't know if anyone's code depends on the O(1) behavior in this case,
      but quite possibly someone's does.
      
      This CL adds the special case back, with a comment to prevent future
      deletions, and without reindenting each function body in full.
      
      Change-Id: I5aba33922b304dd1b8657e6d51d6c937a7f95c81
      Reviewed-on: https://go-review.googlesource.com/78112
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      2a166c93
    • Russ Cox's avatar
      bytes: make ExampleTrimLeft and ExampleTrimRight match · e7628bee
      Russ Cox authored
      ExampleTrimLeft was inexplicably complex.
      
      Change-Id: I13ca81bdeba728bdd632acf82e3a1101d29b9f39
      Reviewed-on: https://go-review.googlesource.com/78111
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarJoe Tsai <thebrokentoaster@gmail.com>
      e7628bee
    • Russ Cox's avatar
      bytes: change ExampleReader_Len to use a non-ASCII string · 22671e73
      Russ Cox authored
      This should help make clear that Len is not counting runes.
      Also delete empty string, which doesn't add much.
      
      Change-Id: I1602352df1897fef6e855e9db0bababb8ab788ca
      Reviewed-on: https://go-review.googlesource.com/78110
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarJoe Tsai <thebrokentoaster@gmail.com>
      22671e73
    • Russ Cox's avatar
      doc/go1.10: first draft of release notes · 04344266
      Russ Cox authored
      Change-Id: If7ec07be4ecb0c1d6a1eb5c0740f150473aea6fa
      Reviewed-on: https://go-review.googlesource.com/78130
      Run-TryBot: Russ Cox <rsc@golang.org>
      Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
      04344266
    • Joe Tsai's avatar
      archive/tar: change error prefix · d9fb9e7c
      Joe Tsai authored
      Change error message prefix from "tar:" to "archive/tar:" to maintain
      backwards compatibility with Go1.9 and earlier in the unfortunate event
      that someone is relying on string parsing of errors.
      
      Fixes #22740
      
      Change-Id: I59039c59818a0599e9d3b06bb5a531aa22a389b8
      Reviewed-on: https://go-review.googlesource.com/77933Reviewed-by: 's avatarroger peppe <rogpeppe@gmail.com>
      d9fb9e7c
    • Daniel Martí's avatar
      go/printer: indent lone comments in composite lits · a265f2e9
      Daniel Martí authored
      If a composite literal contains any comments on their own lines without
      any elements, the printer would unindent the comments.
      
      The comments in this edge case are written when the closing '}' is
      written. Indent and outdent first so that the indentation is
      interspersed before the comment is written.
      
      Also note that the go/printer golden tests don't show the exact same
      behaviour that gofmt does. Added a TODO to figure this out in a separate
      CL.
      
      While at it, ensure that the tree conforms to gofmt. The changes are
      unrelated to this indentation fix, however.
      
      Fixes #22355.
      
      Change-Id: I5ac25ac6de95a236f1e123479127cc4dd71e93fe
      Reviewed-on: https://go-review.googlesource.com/74232
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      a265f2e9
    • Austin Clements's avatar
      runtime: fix gctrace STW CPU time and CPU fraction · 89b7a08a
      Austin Clements authored
      The CPU time reported in the gctrace for STW phases is simply
      work.stwprocs times the wall-clock duration of these phases. However,
      work.stwprocs is set to gcprocs(), which is wrong for multiple
      reasons:
      
      1. gcprocs is intended to limit the number of Ms used for mark
         termination based on how well the garbage collector actually
         scales, but the gctrace wants to report how much CPU time is being
         stolen from the application. During STW, that's *all* of the CPU,
         regardless of how many the garbage collector can actually use.
      
      2. gcprocs assumes it's being called during STW, so it limits its
         result to sched.nmidle+1. However, we're not calling it during STW,
         so sched.nmidle is typically quite small, even if GOMAXPROCS is
         quite large.
      
      Fix this by setting work.stwprocs to min(ncpu, GOMAXPROCS). This also
      fixes the overall GC CPU fraction, which is based on the computed CPU
      times.
      
      Fixes #22725.
      
      Change-Id: I64b5ce87e28dbec6870aa068ce7aecdd28c058d1
      Reviewed-on: https://go-review.googlesource.com/77710
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
      89b7a08a
    • Keith Randall's avatar
      bytes,strings: in generic Index, use mix of IndexByte and Rabin-Karp · a0252775
      Keith Randall authored
      Use IndexByte first, as it allows us to skip lots of bytes quickly.
      If IndexByte is generating a lot of false positives, switch over to Rabin-Karp.
      
      Experiments for ppc64le
      bytes:
      name                             old time/op  new time/op  delta
      IndexPeriodic/IndexPeriodic2-2   1.12ms ± 0%  0.18ms ± 0%  -83.54%  (p=0.000 n=10+9)
      IndexPeriodic/IndexPeriodic4-2    635µs ± 0%   184µs ± 0%  -71.06%  (p=0.000 n=9+9)
      IndexPeriodic/IndexPeriodic8-2    289µs ± 0%   184µs ± 0%  -36.51%  (p=0.000 n=10+9)
      IndexPeriodic/IndexPeriodic16-2   133µs ± 0%   183µs ± 0%  +37.68%  (p=0.000 n=10+9)
      IndexPeriodic/IndexPeriodic32-2  68.3µs ± 0%  70.2µs ± 0%   +2.76%  (p=0.000 n=10+10)
      IndexPeriodic/IndexPeriodic64-2  35.8µs ± 0%  36.6µs ± 0%   +2.17%  (p=0.000 n=8+10)
      
      strings:
      name                             old time/op  new time/op  delta
      IndexPeriodic/IndexPeriodic2-2    184µs ± 0%   184µs ± 0%   +0.11%  (p=0.029 n=4+4)
      IndexPeriodic/IndexPeriodic4-2    184µs ± 0%   184µs ± 0%     ~     (p=0.886 n=4+4)
      IndexPeriodic/IndexPeriodic8-2    184µs ± 0%   184µs ± 0%     ~     (p=0.486 n=4+4)
      IndexPeriodic/IndexPeriodic16-2   185µs ± 1%   184µs ± 0%     ~     (p=0.343 n=4+4)
      IndexPeriodic/IndexPeriodic32-2   184µs ± 0%    69µs ± 0%  -62.37%  (p=0.029 n=4+4)
      IndexPeriodic/IndexPeriodic64-2   184µs ± 0%    37µs ± 0%  -80.17%  (p=0.029 n=4+4)
      
      Fixes #22578
      
      Change-Id: If2a4d8554cb96bfd699b58149d13ac294615f8b8
      Reviewed-on: https://go-review.googlesource.com/76070Reviewed-by: 's avatarAlberto Donizetti <alb.donizetti@gmail.com>
      a0252775
    • Brad Fitzpatrick's avatar
      crypto/sha1, crypto/sha256: add go:noescape annotations · 0ffe90b5
      Brad Fitzpatrick authored
      Additions to:
      https://go-review.googlesource.com/c/go/+/61570
      https://go-review.googlesource.com/c/go/+/61550
      
      Change-Id: Id89e1119333a8721cb9720a04a01dab1f2705fa9
      Reviewed-on: https://go-review.googlesource.com/77591
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      0ffe90b5
    • Hana Kim's avatar
      runtime/trace: fix a typo in doc · f71cbc8a
      Hana Kim authored
      Change-Id: I63f3d2edb09801c99957a1f744639523fb6d0b62
      Reviewed-on: https://go-review.googlesource.com/60331Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      f71cbc8a
    • Awn's avatar
      archive/tar: remove useless type conversions · 23c9db65
      Awn authored
      Change-Id: I259a6ed6a1abc63d2dc39eca7e85f94cf38001cc
      Reviewed-on: https://go-review.googlesource.com/47342Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      23c9db65
    • Marko Mudrinic's avatar
      crypto/sha1, crypto/sha256: fix typo fisrt -> first · 894743b5
      Marko Mudrinic authored
      Change-Id: I9bb7568ca16b420254796eb38dfb86c5ca3399d7
      Reviewed-on: https://go-review.googlesource.com/77890Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      894743b5
    • Ian Lance Taylor's avatar
      cmd/cgo: permit passing string values directly between Go and C · 918396b3
      Ian Lance Taylor authored
      Permit the C preamble to use the _GoString_ type. Permit Go code to
      pass string values directly to those C types. Add accessors for C
      code to retrieve sizes and pointers.
      
      Fixes #6907
      
      Change-Id: I190c88319ec88a3ef0ddb99f342a843ba69fcaa3
      Reviewed-on: https://go-review.googlesource.com/70890
      Run-TryBot: Ian Lance Taylor <iant@golang.org>
      Reviewed-by: 's avatarAustin Clements <austin@google.com>
      918396b3
    • Tim Cooper's avatar
      encoding/pem: add Encode example · 707a4d3f
      Tim Cooper authored
      Change-Id: Ib9ec3524b712e016a9dd2fbee5555362c1a0cb59
      Reviewed-on: https://go-review.googlesource.com/77770Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      707a4d3f
    • wei xiao's avatar
      runtime: IndexByte and memclr perf improvements on arm64 · d259815c
      wei xiao authored
      Update runtime asm_arm64.s and memclr_arm64.s to improve performance by using
      SIMD instructions to do more in parallel. It shows improvement on bytes, html
      and go1 benchmarks (particualrly regexp, which uses IndexByte frequently).
      
      Benchmark results of bytes:
      
      name                     old time/op   new time/op    delta
      IndexByte/10-8            28.5ns ± 0%    19.5ns ± 0%   -31.58%  (p=0.000 n=10+10)
      IndexByte/32-8            52.6ns ± 0%    19.0ns ± 0%   -63.88%  (p=0.000 n=10+10)
      IndexByte/4K-8            4.12µs ± 0%    0.49µs ± 0%   -88.16%  (p=0.000 n=10+10)
      IndexByte/4M-8            4.29ms ± 1%    0.70ms ±26%   -83.65%  (p=0.000 n=10+10)
      IndexByte/64M-8           69.7ms ± 0%    16.0ms ± 0%   -76.97%  (p=0.000 n=9+10)
      IndexBytePortable/10-8    34.0ns ± 0%    34.0ns ± 0%      ~     (all equal)
      IndexBytePortable/32-8    66.1ns ± 0%    66.1ns ± 0%      ~     (p=0.471 n=9+9)
      IndexBytePortable/4K-8    6.17µs ± 0%    6.17µs ± 0%      ~     (all equal)
      IndexBytePortable/4M-8    6.33ms ± 0%    6.35ms ± 0%    +0.21%  (p=0.002 n=10+9)
      IndexBytePortable/64M-8    103ms ± 0%     103ms ± 0%    +0.01%  (p=0.017 n=9+10)
      
      name                     old speed     new speed      delta
      IndexByte/10-8           351MB/s ± 0%   512MB/s ± 0%   +46.14%  (p=0.000 n=9+10)
      IndexByte/32-8           609MB/s ± 0%  1683MB/s ± 0%  +176.40%  (p=0.000 n=10+10)
      IndexByte/4K-8           994MB/s ± 0%  8378MB/s ± 0%  +742.75%  (p=0.000 n=10+10)
      IndexByte/4M-8           977MB/s ± 1%  6149MB/s ±32%  +529.29%  (p=0.000 n=10+10)
      IndexByte/64M-8          963MB/s ± 0%  4182MB/s ± 0%  +334.29%  (p=0.000 n=9+10)
      IndexBytePortable/10-8   294MB/s ± 0%   294MB/s ± 0%    +0.17%  (p=0.000 n=8+8)
      IndexBytePortable/32-8   484MB/s ± 0%   484MB/s ± 0%      ~     (p=0.877 n=9+9)
      IndexBytePortable/4K-8   664MB/s ± 0%   664MB/s ± 0%      ~     (p=0.242 n=8+9)
      IndexBytePortable/4M-8   662MB/s ± 0%   661MB/s ± 0%    -0.21%  (p=0.002 n=10+9)
      IndexBytePortable/64M-8  652MB/s ± 0%   652MB/s ± 0%      ~     (p=0.065 n=10+10)
      
      Benchmark results of html:
      
      name              old time/op  new time/op  delta
      Escape-8          62.0µs ± 1%  61.0µs ± 1%   -1.69%  (p=0.000 n=9+10)
      EscapeNone-8      10.2µs ± 0%  10.2µs ± 0%   -0.09%  (p=0.022 n=9+10)
      Unescape-8        71.9µs ± 0%  68.7µs ± 0%   -4.35%  (p=0.000 n=10+10)
      UnescapeNone-8    4.03µs ± 0%  0.48µs ± 0%  -88.08%  (p=0.000 n=10+10)
      UnescapeSparse-8  10.7µs ± 2%   7.1µs ± 3%  -33.91%  (p=0.000 n=10+10)
      UnescapeDense-8   53.2µs ± 1%  53.5µs ± 1%     ~     (p=0.143 n=10+10)
      
      Benchmark results of go1:
      
      name                     old time/op    new time/op    delta
      BinaryTree17-8              6.53s ± 0%     6.48s ± 2%      ~     (p=0.190 n=4+5)
      Fannkuch11-8                6.35s ± 1%     6.35s ± 0%      ~     (p=1.000 n=5+5)
      FmtFprintfEmpty-8           108ns ± 1%     101ns ± 2%    -6.32%  (p=0.008 n=5+5)
      FmtFprintfString-8          172ns ± 1%     182ns ± 2%    +5.70%  (p=0.008 n=5+5)
      FmtFprintfInt-8             207ns ± 0%     207ns ± 0%      ~     (p=0.444 n=5+5)
      FmtFprintfIntInt-8          277ns ± 1%     276ns ± 1%      ~     (p=0.873 n=5+5)
      FmtFprintfPrefixedInt-8     386ns ± 0%     382ns ± 1%    -1.04%  (p=0.024 n=5+5)
      FmtFprintfFloat-8           492ns ± 0%     492ns ± 1%      ~     (p=0.571 n=4+5)
      FmtManyArgs-8              1.32µs ± 1%    1.33µs ± 0%      ~     (p=0.087 n=5+5)
      GobDecode-8                16.8ms ± 2%    16.7ms ± 1%      ~     (p=1.000 n=5+5)
      GobEncode-8                14.1ms ± 1%    14.0ms ± 1%      ~     (p=0.056 n=5+5)
      Gzip-8                      788ms ± 0%     802ms ± 0%    +1.71%  (p=0.008 n=5+5)
      Gunzip-8                   83.6ms ± 0%    83.9ms ± 0%    +0.40%  (p=0.008 n=5+5)
      HTTPClientServer-8          120µs ± 0%     120µs ± 1%      ~     (p=0.548 n=5+5)
      JSONEncode-8               33.2ms ± 0%    33.0ms ± 1%    -0.71%  (p=0.008 n=5+5)
      JSONDecode-8                152ms ± 1%     152ms ± 1%      ~     (p=1.000 n=5+5)
      Mandelbrot200-8            10.0ms ± 0%    10.0ms ± 0%    -0.05%  (p=0.008 n=5+5)
      GoParse-8                  7.97ms ± 0%    7.98ms ± 0%      ~     (p=0.690 n=5+5)
      RegexpMatchEasy0_32-8       233ns ± 1%     206ns ± 0%   -11.44%  (p=0.016 n=5+4)
      RegexpMatchEasy0_1K-8      1.86µs ± 0%    0.77µs ± 1%   -58.54%  (p=0.008 n=5+5)
      RegexpMatchEasy1_32-8       250ns ± 0%     205ns ± 0%   -18.07%  (p=0.008 n=5+5)
      RegexpMatchEasy1_1K-8      2.28µs ± 0%    1.11µs ± 0%   -51.09%  (p=0.029 n=4+4)
      RegexpMatchMedium_32-8      332ns ± 1%     301ns ± 2%    -9.45%  (p=0.008 n=5+5)
      RegexpMatchMedium_1K-8     85.5µs ± 2%    78.8µs ± 0%    -7.83%  (p=0.008 n=5+5)
      RegexpMatchHard_32-8       4.34µs ± 1%    4.27µs ± 0%    -1.49%  (p=0.008 n=5+5)
      RegexpMatchHard_1K-8        130µs ± 1%     127µs ± 0%    -2.53%  (p=0.008 n=5+5)
      Revcomp-8                   1.35s ± 1%     1.13s ± 1%   -16.17%  (p=0.008 n=5+5)
      Template-8                  160ms ± 2%     162ms ± 2%      ~     (p=0.222 n=5+5)
      TimeParse-8                 795ns ± 2%     778ns ± 1%      ~     (p=0.095 n=5+5)
      TimeFormat-8                782ns ± 0%     786ns ± 1%    +0.59%  (p=0.040 n=5+5)
      
      name                     old speed      new speed      delta
      GobDecode-8              45.8MB/s ± 2%  45.9MB/s ± 1%      ~     (p=1.000 n=5+5)
      GobEncode-8              54.3MB/s ± 1%  55.0MB/s ± 1%      ~     (p=0.056 n=5+5)
      Gzip-8                   24.6MB/s ± 0%  24.2MB/s ± 0%    -1.69%  (p=0.008 n=5+5)
      Gunzip-8                  232MB/s ± 0%   231MB/s ± 0%    -0.40%  (p=0.008 n=5+5)
      JSONEncode-8             58.4MB/s ± 0%  58.8MB/s ± 1%    +0.71%  (p=0.008 n=5+5)
      JSONDecode-8             12.8MB/s ± 1%  12.8MB/s ± 1%      ~     (p=1.000 n=5+5)
      GoParse-8                7.27MB/s ± 0%  7.26MB/s ± 0%      ~     (p=0.762 n=5+5)
      RegexpMatchEasy0_32-8     137MB/s ± 1%   155MB/s ± 0%   +12.93%  (p=0.008 n=5+5)
      RegexpMatchEasy0_1K-8     551MB/s ± 0%  1329MB/s ± 1%  +141.11%  (p=0.008 n=5+5)
      RegexpMatchEasy1_32-8     128MB/s ± 0%   156MB/s ± 0%   +22.00%  (p=0.008 n=5+5)
      RegexpMatchEasy1_1K-8     449MB/s ± 0%   920MB/s ± 0%  +104.68%  (p=0.016 n=4+5)
      RegexpMatchMedium_32-8   3.00MB/s ± 0%  3.32MB/s ± 2%   +10.60%  (p=0.016 n=4+5)
      RegexpMatchMedium_1K-8   12.0MB/s ± 2%  13.0MB/s ± 0%    +8.48%  (p=0.008 n=5+5)
      RegexpMatchHard_32-8     7.38MB/s ± 1%  7.49MB/s ± 0%    +1.49%  (p=0.008 n=5+5)
      RegexpMatchHard_1K-8     7.88MB/s ± 1%  8.08MB/s ± 0%    +2.59%  (p=0.008 n=5+5)
      Revcomp-8                 188MB/s ± 1%   224MB/s ± 1%   +19.29%  (p=0.008 n=5+5)
      Template-8               12.2MB/s ± 2%  12.0MB/s ± 2%      ~     (p=0.206 n=5+5)
      
      Change-Id: I94116620a287d173a6f60510684362e500f54887
      Reviewed-on: https://go-review.googlesource.com/33597
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
      d259815c
    • OneOfOne's avatar
      net/url: allow *User functions to work on a nil receiver. · 466e299d
      OneOfOne authored
      Fixes #20924
      
      Change-Id: If89f31da63cbea38d7e615a428b7b07629770a45
      Reviewed-on: https://go-review.googlesource.com/47851
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarTim Cooper <tim.cooper@layeh.com>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      466e299d
    • Tim Cooper's avatar
      encoding/pem: add Encode, EncodeToMemory docs · f4f6018d
      Tim Cooper authored
      Included in a warning that EncodeToMemory may return an incomplete PEM
      encoded structure if invalid headers are supplied. Example:
      
      	pem.EncodeToMemory(&pem.Block{
      		Headers: map[string]string{
      			"a":   "test1",
      			"b:c": "test2",
      		},
      	})
      
      Returns:
      
      	-----BEGIN -----
      	a: test1
      
      Change-Id: Ia9cf0202f985e3cf210aabb6f07667e581ff081f
      Reviewed-on: https://go-review.googlesource.com/77790Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      f4f6018d
    • Tw's avatar
      net/http: don't set Content-Type with empty body automatically · 8cdd999b
      Tw authored
      We set Content-Type to "text/plain; charset=utf-8" even with blank body
      before. Let's strip this unnecessary header though it's harmless in most
      cases.
      
      Fixes #20784
      Signed-off-by: 's avatarTw <tw19881113@gmail.com>
      
      Change-Id: Ic58a410dcbc89f457c6ddd92961d9cbf545b2f4f
      Reviewed-on: https://go-review.googlesource.com/46631
      Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      8cdd999b
    • Roger Peppe's avatar
      crypto, hash: document marshal/unmarshal implementation · bd926e1c
      Roger Peppe authored
      Unless you go back and read the hash package documentation, it's
      not clear that all the hash packages implement marshaling and
      unmarshaling. Document the behaviour specifically in each package
      that implements it as it this is hidden behaviour and easy to miss.
      
      Change-Id: Id9d3508909362f1a3e53872d0319298359e50a94
      Reviewed-on: https://go-review.googlesource.com/77251Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: 's avatarJoe Tsai <thebrokentoaster@gmail.com>
      bd926e1c
  3. 14 Nov, 2017 5 commits
    • Ian Lance Taylor's avatar
      runtime: call amd64 VDSO entry points on large stack · a158382b
      Ian Lance Taylor authored
      If the Linux kernel was built with CONFIG_OPTIMIZE_INLINING=n and was
      built with hardening options turned on, GCC will insert a stack probe
      in the VDSO function that requires a full page of stack space.
      The stack probe can corrupt memory if another thread is using it.
      Avoid sporadic crashes by calling the VDSO on the g0 or gsignal stack.
      
      While we're at it, align the stack as C code expects. We've been
      getting away with a misaligned stack, but it's possible that the VDSO
      code will change in the future to break that assumption.
      
      Benchmarks show a 11% hit on time.Now, but it's only 6ns.
      
      name                      old time/op  new time/op  delta
      AfterFunc-12              1.66ms ± 0%  1.66ms ± 1%     ~     (p=0.905 n=9+10)
      After-12                  1.90ms ± 6%  1.86ms ± 0%   -2.05%  (p=0.012 n=10+8)
      Stop-12                    113µs ± 3%   115µs ± 2%   +1.60%  (p=0.017 n=9+10)
      SimultaneousAfterFunc-12   145µs ± 1%   144µs ± 0%   -0.68%  (p=0.002 n=10+8)
      StartStop-12              39.5µs ± 3%  40.4µs ± 5%   +2.19%  (p=0.023 n=10+10)
      Reset-12                  10.2µs ± 0%  10.4µs ± 0%   +2.45%  (p=0.000 n=10+9)
      Sleep-12                   190µs ± 1%   190µs ± 1%     ~     (p=0.971 n=10+10)
      Ticker-12                 4.68ms ± 2%  4.64ms ± 2%   -0.83%  (p=0.043 n=9+10)
      Now-12                    48.4ns ±11%  54.0ns ±11%  +11.42%  (p=0.017 n=10+10)
      NowUnixNano-12            48.5ns ±13%  56.9ns ± 8%  +17.30%  (p=0.000 n=10+10)
      Format-12                  489ns ±11%   504ns ± 6%     ~     (p=0.289 n=10+10)
      FormatNow-12               436ns ±23%   480ns ±13%  +10.25%  (p=0.026 n=9+10)
      MarshalJSON-12             656ns ±14%   587ns ±24%     ~     (p=0.063 n=10+10)
      MarshalText-12             647ns ± 7%   638ns ± 9%     ~     (p=0.516 n=10+10)
      Parse-12                   348ns ± 8%   328ns ± 9%   -5.66%  (p=0.030 n=10+10)
      ParseDuration-12           136ns ± 9%   140ns ±11%     ~     (p=0.425 n=10+10)
      Hour-12                   14.8ns ± 6%  15.6ns ±11%     ~     (p=0.085 n=10+10)
      Second-12                 14.0ns ± 6%  14.3ns ±12%     ~     (p=0.443 n=10+10)
      Year-12                   32.4ns ±11%  33.4ns ± 6%     ~     (p=0.492 n=10+10)
      Day-12                    41.5ns ± 9%  42.3ns ±12%     ~     (p=0.239 n=10+10)
      
      Fixes #20427
      
      Change-Id: Ia395cbb863215f4499b8e7ef95f4b99f51090911
      Reviewed-on: https://go-review.googlesource.com/76990Reviewed-by: 's avatarAustin Clements <austin@google.com>
      a158382b
    • Michael Stapelberg's avatar
      net/mail: treat comment in address as display name · fcee1897
      Michael Stapelberg authored
      I verified this change on a corpus of > 200 GB of emails since the mid-90s. With
      this change, more addresses parse than before, and anything which parsed before
      still parses.
      
      In said corpus, I came across the edge case of comments preceding an
      addr-spec (with angle brackets!), e.g. “(John Doe) <john@example.com>”, which
      does not satisfy the conditions to be treated as a fallback, as per my reading
      of RFC2822.
      
      This change does not parse quoted-strings within comments (a corresponding TODO
      is in the code), but I have not seen that in the wild.
      
      Fixes #22670
      
      Change-Id: I526fcf7c6390aa1c219fdec1852f26c514506f76
      Reviewed-on: https://go-review.googlesource.com/77474Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      fcee1897
    • Hana Kim's avatar
      doc: correct supported gdb version info · 01c979da
      Hana Kim authored
      GDB 7.5 recognizes DWARF4 by default.
      
      GDB 7.5 release note does not explicitly mention DWARF4 support
      but according to GCC 4.8 release note
       https://gcc.gnu.org/gcc-4.8/changes.html
      
       "DWARF4 is now the default when generating DWARF debug
       information. ...
       GDB 7.5, Valgrind 3.8.0 and elfutils 0.154 debug information
       consumers support DWARF4 by default."
      
      Change-Id: I56b011c7c38fbc103bbd366ceaea3b709c66ab7f
      Reviewed-on: https://go-review.googlesource.com/77570Reviewed-by: 's avatarAlberto Donizetti <alb.donizetti@gmail.com>
      01c979da
    • Fangming.Fang's avatar
      internal/cpu: detect cpu features in internal/cpu package · 66bfbd9a
      Fangming.Fang authored
      change hash/crc32 package to use cpu package instead of using
      runtime internal variables to check crc32 instruction
      
      Change-Id: I8f88d2351bde8ed4e256f9adf822a08b9a00f532
      Reviewed-on: https://go-review.googlesource.com/76490Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      66bfbd9a
    • Brad Fitzpatrick's avatar
      internal/cpu: fix arm64 build · b3ee6f0c
      Brad Fitzpatrick authored
      I submitted two CLs which broke the build. Add temporary placeholder
      with false bools to fix the build and restore old behavior.
      
      Updates golang/go#22718 (details of why it broke)
      
      Change-Id: I1f30624e14f631a95f4eff5aae462f1091f723a2
      Reviewed-on: https://go-review.googlesource.com/77590Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      b3ee6f0c