]> Cypherpunks repositories - gostls13.git/commit
encoding/base64: optimize decodemap memory set
authorErikPelli <erikpellizzon1@gmail.com>
Sun, 14 Aug 2022 07:46:22 +0000 (07:46 +0000)
committerGopher Robot <gobot@golang.org>
Wed, 17 Aug 2022 03:15:44 +0000 (03:15 +0000)
commite1b62efaf33988a5153510898d37309cee78f26e
tree5fad1a4faaaa21f907c283f4359c8241c8bb6265
parent0d8efa6e842169e61cbe343441092b6f7c9b886c
encoding/base64: optimize decodemap memory set

The existing implementation has an execution time higher in the benchmark than this one.
This is an optimized implementation using the copy() function and a constant 256 bytes string with the values to be copied.

```
name           old time/op    new time/op    delta
NewEncoding-4     329ns ± 1%     231ns ± 1%  -29.72%  (p=0.008 n=5+5)

name           old speed      new speed      delta
NewEncoding-4   778MB/s ± 1%  1108MB/s ± 1%  +42.29%  (p=0.008 n=5+5)
```

Fixes #53211

Change-Id: I80fe62aa40623125ef81ae9164a8405eed30b71b
GitHub-Last-Rev: 55dce6f636ad29a70daa935169710c22f44ab31f
GitHub-Pull-Request: golang/go#53212
Reviewed-on: https://go-review.googlesource.com/c/go/+/410194
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/encoding/base32/base32.go
src/encoding/base64/base64.go
src/encoding/base64/base64_test.go