-
Notifications
You must be signed in to change notification settings - Fork 20.6k
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
core/state: optimize some internals during encoding #20038
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3631654
to
f8e2c3a
Compare
karalabe
reviewed
Sep 10, 2019
karalabe
reviewed
Sep 10, 2019
common/hexutil/hexutil.go
Outdated
if idx > 0 { | ||
return s[idx:] | ||
} | ||
return s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return s[idx:]
always?
karalabe
reviewed
Sep 10, 2019
karalabe
requested changes
Sep 10, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM
14cd31d
to
1c82f03
Compare
karalabe
reviewed
Sep 10, 2019
1c82f03
to
e82b3b1
Compare
Linter fails, pls gofmt |
e82b3b1
to
72045df
Compare
done, let's see what the linter says next... |
19 tasks
gzliudan
added a commit
to gzliudan/XDPoSChain
that referenced
this pull request
Dec 19, 2024
gzliudan
added a commit
to gzliudan/XDPoSChain
that referenced
this pull request
Dec 21, 2024
gzliudan
added a commit
to gzliudan/XDPoSChain
that referenced
this pull request
Dec 26, 2024
gzliudan
added a commit
to gzliudan/XDPoSChain
that referenced
this pull request
Dec 28, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed this wile investigating the state a bit. What we currently do before RLP-encoding a slot value is to call
TrimLeft
:... which dynamically creates a
cutSetFunction
.Then it calls
TrimLeftFunc
, which:It interprets the data as
UTF-8
encoded data, and parses runes.In our case, it's the wrong abstraction, what we want to do here is simply trim leading zeroes, which has nothing whatsoever to do with
UTF-8
and runes.This PR replaces that with a simple for-loop, more or less.
benchmark results:
It's probably a drop in the ocean though...