Skip to content

math/big: regression in BitLen #57014

Closed
Closed
@rsc

Description

@rsc

CL 450055 replaced big.Int.BitLen with a portable constant-time operation for fear of bits.LeadingZeros using a lookup table on some architectures (notably not on x86, which uses a hardware instruction). @drchase's benchmarks found https://perf.golang.org/search?q=upload%3A20221130.13+pkg%3Agithub.com%2Fericlagergren%2Fdecimal%2Fbenchmarks, non-crypto code with a significant performance hit for a property (constant-time) it didn't need.

Talked to @FiloSottile, and he is going to send a CL removing use of big.Int.BitLen from crypto code and restoring the old implementation.

Filing issue so we remember to submit the CL before the release.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions