Skip to content

Conversation

@trinhdn2
Copy link

@trinhdn2 trinhdn2 commented Jun 20, 2023

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:

@trinhdn2 trinhdn2 marked this pull request as ready for review June 21, 2023 04:43
@trinhdn2 trinhdn2 mentioned this pull request Jun 21, 2023
14 tasks
@trinhdn2 trinhdn2 changed the base branch from master to upgrade-core-develop July 3, 2023 05:36
@trinhdn2 trinhdn2 changed the title Update RLP library and RLP encoder code generation tool for structs [Non-breaking changes] Update RLP library and RLP encoder code generation tool for structs Jul 14, 2023
@trinhdn2 trinhdn2 marked this pull request as draft July 16, 2023 13:29
@trinhdn2 trinhdn2 marked this pull request as ready for review July 16, 2023 13:48
Copy link
Collaborator

@imterryyy imterryyy left a comment

Choose a reason for hiding this comment

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

LGTM

@tungng98 tungng98 deleted the branch BuildOnViction:upgrade-core-develop December 10, 2023 16:51
@tungng98 tungng98 closed this Dec 10, 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

Development

Successfully merging this pull request may close these issues.

4 participants