1. 31 Oct, 2019 2 commits
    • Daniel Martí's avatar
      encoding/json: avoid work when unquoting strings, take 2 · 54697702
      Daniel Martí authored
      This is a re-submission of CL 151157, since it was reverted in CL 190909
      due to an introduced crash found by a fuzzer. The revert CL included
      regression tests, while this CL includes a fixed version of the original
      change.
      
      In particular, what we forgot in the original optimization was that we
      still need the length and trailing quote checks at the beginning of
      unquoteBytes. Without those, we could end up in a crash later on.
      
      We can work out how many bytes can be unquoted trivially in
      rescanLiteral, which already iterates over a string's bytes.
      
      Removing the extra loop in unquoteBytes simplifies the function and
      speeds it up, especially when decoding simple strings, which are common.
      
      While at it, we can remove the check that s[0]=='"', since all call
      sites already meet that condition.
      
      name           old time/op    new time/op    delta
      CodeDecoder-8    10.6ms ± 2%    10.5ms ± 1%  -1.01%  (p=0.004 n=20+10)
      
      name           old speed      new speed      delta
      CodeDecoder-8   183MB/s ± 2%   185MB/s ± 1%  +1.02%  (p=0.003 n=20+10)
      
      Updates #28923.
      
      Change-Id: I8c6b13302bcd86a364bc998d72451332c0809cde
      Reviewed-on: https://go-review.googlesource.com/c/go/+/190659
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarPeter Weinberger <pjw@google.com>
      54697702
    • Michael Munday's avatar
      runtime/internal/atomic: add tests for And8 and Or8 · 10855608
      Michael Munday authored
      Add some simple unit tests for these atomic operations. These can't
      catch all the bugs that are possible with these operations but at
      least they provide some coverage.
      
      Change-Id: I94b9f451fcc9fecdb2a1448c5357b019563ad275
      Reviewed-on: https://go-review.googlesource.com/c/go/+/204317
      Run-TryBot: Michael Munday <mike.munday@ibm.com>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      10855608
  2. 30 Oct, 2019 12 commits
  3. 29 Oct, 2019 24 commits
  4. 28 Oct, 2019 2 commits