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

Remove calls to heapsize #10432

Merged
merged 29 commits into from
Jun 19, 2019
Merged

Remove calls to heapsize #10432

merged 29 commits into from
Jun 19, 2019

Conversation

cheme
Copy link
Contributor

@cheme cheme commented Feb 27, 2019

This pr remove calls to heapsize crate (the crate will still be in the dependency tree from other crates).
It replace heapsize calls by malloc_size call which are basically the same but defined into 'parity-util-mem' (we got additional option and a feature for only running memory estimation (not calling the allocator)).
This cannot be merged as it is and require first that paritytech/parity-common#93 get merged and published and then that paritytech/trie#14 get merged and published. See the patched crates in Cargo.toml.

Yet it can be reviewed.

Also it is currently set (in Cargo.toml) to use jemalloc and crate size estimation (that may not be the target).

@cheme cheme added the A0-pleasereview 🤓 Pull request needs code review. label Feb 27, 2019
@soc1c soc1c added the M4-core ⛓ Core client code / Rust. label Feb 27, 2019
@soc1c soc1c added this to the 2.5 milestone Feb 27, 2019
@soc1c soc1c modified the milestones: 2.5, 2.6 Apr 2, 2019
will require full upgrade of mem-db hash-db trie-db (memdb only is not
enough).
also parity common crate using those three need an upgrade (plus
trie-hash need feature std to avoid error on build).
@dvdplm
Copy link
Collaborator

dvdplm commented Jun 3, 2019

Note: paritytech/parity-common#93 is now merged.

Copy link
Collaborator

@dvdplm dvdplm left a comment

Choose a reason for hiding this comment

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

Good stuff. I'll be back for a proper review once the trie is updated so I can run the code. :)

impl HeapSizeOf for Cache {
fn heap_size_of_children(&self) -> usize {

// TODO this is fast method: should feature gate an exhaustive implementation
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please file an issue and add a ref to this comment.

@@ -63,7 +63,8 @@ extern crate parity_bytes as bytes;
extern crate ethereum_types;
extern crate ethcore;
extern crate hash_db;
extern crate heapsize;
extern crate parity_util_mem as malloc_size_of;
extern crate parity_util_mem as mem;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is confusing, it will require devs to come here to look. I think I'd prefer explicit paths here.

ethcore/src/engines/validator_set/test.rs Outdated Show resolved Hide resolved
@@ -97,6 +96,8 @@ extern crate patricia_trie_ethereum as ethtrie;
extern crate rand;
extern crate rayon;
extern crate rlp;
extern crate parity_util_mem as mem;
extern crate parity_util_mem as malloc_size_of;
Copy link
Collaborator

Choose a reason for hiding this comment

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

idem as above

@@ -16,7 +16,8 @@

//! `JournalDB` interface and implementation.

extern crate heapsize;
extern crate parity_util_mem as mem;
extern crate parity_util_mem as malloc_size_of;
Copy link
Collaborator

Choose a reason for hiding this comment

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

idem as above

@dvdplm
Copy link
Collaborator

dvdplm commented Jun 4, 2019

Needs rebase.

@dvdplm dvdplm requested a review from ordian June 7, 2019 13:34
Copy link
Collaborator

@dvdplm dvdplm left a comment

Choose a reason for hiding this comment

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

The heapsizeof removal seems straight forward and I like it a lot.

The new trie api with all those the prefix stuff is not so nice, but I honestly don't know of a better way. :/
I'm also not clear on why we needed the prefix in the first place, but I'll ask that question elsewhere.

ethcore/evm/src/interpreter/shared_cache.rs Outdated Show resolved Hide resolved
ethcore/light/src/client/header_chain.rs Outdated Show resolved Hide resolved
@dvdplm
Copy link
Collaborator

dvdplm commented Jun 10, 2019

@cheme I've run this branch on mainnet over the weekend. Looks good. Very odd that CI failed after last commit, seems completely unrelated. Launched a new run.

@dvdplm
Copy link
Collaborator

dvdplm commented Jun 12, 2019

So things left to do here:

  • remove patches in Cargo.toml once all referenced crates are published
  • set parity-ethereum to use jemalloc
  • use estimation wherever possible
  • await needed changes to triehash before merging

Copy link
Collaborator

@ordian ordian left a comment

Choose a reason for hiding this comment

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

LGTM modulo David's comments.

Copy link
Collaborator

@dvdplm dvdplm left a comment

Choose a reason for hiding this comment

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

This is good to go. I had some small nitpicks but if you're busy with other stuff I'm ok merging this as-is.

@cheme
Copy link
Contributor Author

cheme commented Jun 19, 2019

I am going to address them (malloc_size_of alias when it is required by the derive macro). I thought I did address them but that was not the case :(

@ordian ordian added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Jun 19, 2019
@dvdplm
Copy link
Collaborator

dvdplm commented Jun 19, 2019

@cheme merge whenever you're ready.

@cheme cheme merged commit 6fc5014 into openethereum:master Jun 19, 2019
dvdplm added a commit that referenced this pull request Jun 24, 2019
…anager

* master:
  Print warnings when using dangerous settings for ValidatorSet (#10733)
  ethcore/res: activate atlantis classic hf on block 8772000 (#10766)
  refactor: Fix indentation (#10740)
  Updated Bn128PairingImpl to use optimized batch pairing  (#10765)
  fix: aura don't add `SystemTime::now()` (#10720)
  Initialize private tx logger only if private tx functionality is enabled (#10758)
  Remove unused code (#10762)
  Remove calls to heapsize (#10432)
dvdplm added a commit that referenced this pull request Jun 25, 2019
…dp/fix/prevent-building-block-on-top-of-same-parent

* dp/chore/aura-log-validator-set-in-epoch-manager:
  remove dead code
  Treat empty account the same as non-exist accounts in EIP-1052 (#10775)
  docs: Update Readme with TOC, Contributor Guideline. Update Cargo package descriptions (#10652)
  cleanup
  On second thought non-validators are allowed to report
  Move Engine::register_client to be before other I/O handler registration (#10767)
  cleanup
  Print warnings when using dangerous settings for ValidatorSet (#10733)
  ethcore/res: activate atlantis classic hf on block 8772000 (#10766)
  refactor: Fix indentation (#10740)
  Updated Bn128PairingImpl to use optimized batch pairing  (#10765)
  fix: aura don't add `SystemTime::now()` (#10720)
  Initialize private tx logger only if private tx functionality is enabled (#10758)
  Remove unused code (#10762)
  Remove calls to heapsize (#10432)
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.

4 participants