Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

secp256k1: Optimize precomp value storage. #2885

Merged
merged 2 commits into from
Mar 2, 2022

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Feb 23, 2022

This requires #2884.

This optimizes the storage of the pre-computed byte points used to accelerate scalar base multiplication to store the data as 32-byte big-endian integers instead of as a series of little-endian uint32s which reduces the amount of uncompressed bytes that need to stored by 128KiB.

Further, since the compressed table is stored in the string table of the binary, it also reduces the size the of final binary by ~92.5KiB.

@davecgh davecgh added this to the 1.8.0 milestone Feb 23, 2022
This modifies the logic that deals with generating, loading, and
decompressing the compressed byte points to allow go generate to run
correctly regardless of whether or not the generated file already
exists.

It accomplishes this by making use of a function to obtain the
compressed byte points string instead of directly referencing the
variable such that the function is nil by default and only set to the
real function via the generated file.
This optimizes the storage of the pre-computed byte points used to
accelerate scalar base multiplication to store the data as 32-byte
big-endian integers instead of as a series of little-endian uint32s
which reduces the amount of uncompressed bytes that need to stored by
128KiB.

Further, since the compressed table is stored in the string table of the
binary, it also reduces the size the of final binary by ~92.5KiB.
Copy link
Member

@matheusd matheusd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternative summary for this change would be that this is changing the representation of the stored byte points from the native field val repr (40 bytes) to unprocessed, "packed" byte slices.

@davecgh davecgh merged commit b495d21 into decred:master Mar 2, 2022
@davecgh davecgh deleted the secp256k1_optimize_precomp_storage branch March 2, 2022 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants