-
Notifications
You must be signed in to change notification settings - Fork 246
[rlp] Add no_std support #167
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
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ecea884
Support no_std for rlp; Migrate rlp crate to 2018 edition
koushiro bfca031
Modify CI config to support the no_std test of rlp
koushiro 17a5a21
Remove useless test
koushiro bb76515
Fix ci
koushiro 89a6be2
Merge remote-tracking branch 'upstream/master' into rlp_no_std
koushiro a137df0
Move tests
koushiro 1ce5187
Merge remote-tracking branch 'upstream/master' into rlp_no_std
koushiro 822933d
Merge remote-tracking branch 'upstream/master' into rlp_no_std
koushiro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,6 @@ | |
| // TODO: get rid of this one fine day: https://doc.rust-lang.org/nightly/edition-guide/rust-2018/module-system/path-clarity.html#an-exception | ||
| extern crate test; | ||
|
|
||
| use primitive_types::U256; | ||
| use rlp::{RlpStream, Rlp}; | ||
| use test::Bencher; | ||
|
|
||
|
|
@@ -41,29 +40,6 @@ fn bench_decode_u64_value(b: &mut Bencher) { | |
| }); | ||
| } | ||
|
|
||
| #[bench] | ||
| fn bench_stream_u256_value(b: &mut Bencher) { | ||
| b.iter(|| { | ||
| // u256 | ||
| let mut stream = RlpStream::new(); | ||
| let uint: U256 = "8090a0b0c0d0e0f00910203040506077000000000000000100000000000012f0".into(); | ||
| stream.append(&uint); | ||
| let _ = stream.out(); | ||
| }); | ||
| } | ||
|
|
||
| #[bench] | ||
| fn bench_decode_u256_value(b: &mut Bencher) { | ||
| b.iter(|| { | ||
| // u256 | ||
| let data = vec![0xa0, 0x80, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, 0x09, 0x10, 0x20, | ||
| 0x30, 0x40, 0x50, 0x60, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0xf0]; | ||
| let rlp = Rlp::new(&data); | ||
| let _ : U256 = rlp.as_val().unwrap(); | ||
| }); | ||
| } | ||
|
|
||
| #[bench] | ||
| fn bench_stream_nested_empty_lists(b: &mut Bencher) { | ||
| b.iter(|| { | ||
|
|
@@ -105,13 +81,13 @@ fn bench_stream_1000_empty_lists(b: &mut Bencher) { | |
| fn bench_decode_1000_values(b: &mut Bencher) { | ||
| let mut stream = RlpStream::new_list(1000); | ||
| for _ in 0..1000 { | ||
| stream.append(&U256::from(1)); | ||
| stream.append(&1u64); | ||
| } | ||
| let data= stream.out(); | ||
| b.iter(|| { | ||
| let rlp = Rlp::new(&data); | ||
| for i in 0..1000 { | ||
| let _: U256 = rlp.val_at(i).unwrap(); | ||
| let _: u64 = rlp.val_at(i).unwrap(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use the same data length as before here. |
||
| } | ||
| }); | ||
| } | ||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
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.
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.
This changes the amount of data tested, making it impossible to compare tests before/after this change.
In general I'm not sure why the dev dependencies can't depend on
primitive-types(or any other code, be itno_stdor not). I think the benchmark use the big uint types because it is such a common use case for the crate. What's the point of having the benchmarks beno_std?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.
Please use the same data length as before here.