]> Cypherpunks repositories - gostls13.git/commit
encoding/asn1: remove allocation from init
authorTomasz Jezierski <tjomek.jezierski@gmail.com>
Fri, 30 Sep 2022 14:17:45 +0000 (16:17 +0200)
committerGopher Robot <gobot@golang.org>
Tue, 4 Oct 2022 23:29:48 +0000 (23:29 +0000)
commit9c2fd81ee11c1c49e55f1c59a96e170f2d53e6c8
tree3bb97a9e85fee70d4fe0dbdb35632ffa759e1efc
parent0fec65d281af8932ce8da946faa55884f2427cfc
encoding/asn1: remove allocation from init

asn1 allocates due to reflect.TypeOf(new(big.Int)) in init time.
We could replace it with (*big.Int)(nil).

Before:
init encoding/asn1 @1.0 ms, 0.009 ms clock, 224 bytes, 7 allocs

After:
init encoding/asn1 @0.70 ms, 0.002 ms clock, 192 bytes, 6 allocs

Fixes #55973

Change-Id: I7c3cc0f48631af73cf34ad3c731c380f46c72359
Reviewed-on: https://go-review.googlesource.com/c/go/+/435257
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: hopehook <hopehook@golangcn.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
src/encoding/asn1/asn1.go