Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

perf(ethcore): micro-opt #10405

Merged
merged 1 commit into from
Mar 6, 2019
Merged

perf(ethcore): micro-opt #10405

merged 1 commit into from
Mar 6, 2019

Conversation

niklasad1
Copy link
Collaborator

@niklasad1 niklasad1 commented Feb 22, 2019

Mostly fixes that changes eagerly eval to lazy eval shouldn't impact much

@@ -83,7 +83,7 @@ pub enum ProvedExecution {
/// The transaction failed, but not due to a bad proof.
Failed(ExecutionError),
/// The transaction successfully completd with the given proof.
Complete(Executed),
Complete(Box<Executed>),
Copy link
Collaborator Author

@niklasad1 niklasad1 Feb 23, 2019

Choose a reason for hiding this comment

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

Executed is quite big (368 bytes) and thus the enum will be size of biggest enum value.

For example if a function returns ProvedExecution the compiler must preserve stack to be at least 368 because it can't know which branch to take (technically the caller preserve must preserve this).

However, I'm not sure of the performance implications because I haven't benched it but I guess 5-40% (might even be worse when a lot calls are chained, i.e. passed on into to several functions by value)

Seems to only be used by light::on_demand::request and engine::validator_set::safe_contract

@@ -84,7 +84,7 @@ pub enum BlockError {
/// Timestamp header field is too far in future.
TemporarilyInvalid(OutOfBounds<SystemTime>),
/// Log bloom header field is invalid.
InvalidLogBloom(Mismatch<Bloom>),
InvalidLogBloom(Box<Mismatch<Bloom>>),
Copy link
Collaborator Author

@niklasad1 niklasad1 Feb 23, 2019

Choose a reason for hiding this comment

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

Bloom: 256 bytes

Mostly fixes that changes `eagerly eval` to `lazy eval`
@folsen
Copy link
Contributor

folsen commented Feb 25, 2019

@niklasad1 is it possible to add some microbenchmarks to this as well to see what the change is? I feel like we could use more benchmarks across the board

@niklasad1
Copy link
Collaborator Author

@folsen yeah I think so. I can try to add that but I think the only noticeable difference is the changed enum

@soc1c soc1c added this to the 2.5 milestone Feb 25, 2019
@soc1c soc1c added A0-pleasereview 🤓 Pull request needs code review. M4-core ⛓ Core client code / Rust. labels Feb 25, 2019
Copy link
Contributor

@ascjones ascjones left a comment

Choose a reason for hiding this comment

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

LGTM

@ascjones ascjones added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Feb 26, 2019
@debris debris merged commit 91933d8 into master Mar 6, 2019
@debris debris deleted the ethcore-micro-opt branch March 6, 2019 14:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A8-looksgood 🦄 Pull request is reviewed well. M4-core ⛓ Core client code / Rust.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants