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

[Non-breaking changes] Update RLP library and RLP encoder code generation tool for structs #2

Merged
merged 9 commits into from Sep 25, 2023

Conversation

tungnguyen17
Copy link
Owner

This PR catchs up the latest RLP library of go-ethereum, including the RLP encoder code generator, also backwards compatible with the current RLP library of tomochain.

Benchmark results:

goos: darwin
goarch: amd64
pkg: github.com/tomochain/tomochain/core/types
cpu: VirtualApple @ 2.50GHz
                                │ old_encodeRLP.txt │          new_encodeRLP.txt          │
                                │      sec/op       │   sec/op     vs base                │
EncodeRLP/header-8                      267.2n ± 1%   212.0n ± 0%  -20.67% (p=0.000 n=20)
EncodeRLP/receipt-for-storage-8         275.5n ± 1%   268.2n ± 1%   -2.65% (p=0.000 n=20)
EncodeRLP/receipt-full-8                232.2n ± 1%   222.6n ± 0%   -4.16% (p=0.000 n=20)
EncodeRLP/transaction-8                 268.4n ± 1%   266.9n ± 0%   -0.54% (p=0.000 n=20)
geomean                                 260.3n        241.1n        -7.37%

                                │ old_encodeRLP.txt │          new_encodeRLP.txt           │
                                │        B/s        │     B/s       vs base                │
EncodeRLP/header-8                     1.903Gi ± 1%   2.399Gi ± 0%  +26.06% (p=0.000 n=20)
EncodeRLP/receipt-for-storage-8        1.099Gi ± 1%   1.129Gi ± 1%   +2.72% (p=0.000 n=20)
EncodeRLP/receipt-full-8               1.083Gi ± 1%   1.130Gi ± 0%   +4.35% (p=0.000 n=20)
EncodeRLP/transaction-8                362.5Mi ± 1%   364.5Mi ± 0%   +0.56% (p=0.000 n=20)
geomean                                968.8Mi        1.021Gi        +7.97%

                                │ old_encodeRLP.txt │          new_encodeRLP.txt          │
                                │       B/op        │    B/op     vs base                 │
EncodeRLP/header-8                     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
EncodeRLP/receipt-for-storage-8        384.0 ± 0%     384.0 ± 0%       ~ (p=1.000 n=20) ¹
EncodeRLP/receipt-full-8               320.0 ± 0%     320.0 ± 0%       ~ (p=1.000 n=20) ¹
EncodeRLP/transaction-8                0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
geomean                                           ²               +0.00%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                                │ old_encodeRLP.txt │          new_encodeRLP.txt          │
                                │     allocs/op     │ allocs/op   vs base                 │
EncodeRLP/header-8                     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
EncodeRLP/receipt-for-storage-8        1.000 ± 0%     1.000 ± 0%       ~ (p=1.000 n=20) ¹
EncodeRLP/receipt-full-8               1.000 ± 0%     1.000 ± 0%       ~ (p=1.000 n=20) ¹
EncodeRLP/transaction-8                0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20) ¹
geomean                                           ²               +0.00%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

References:

@tungnguyen17 tungnguyen17 merged commit a97da7d into tungnguyen17:master Sep 25, 2023
tungnguyen17 pushed a commit that referenced this pull request Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants