Skip to content

Provide #[derive(MallocSizeOf)] that is actually working#291

Merged
NikVolf merged 12 commits into
masterfrom
nv-mem-utils-2
Dec 31, 2019
Merged

Provide #[derive(MallocSizeOf)] that is actually working#291
NikVolf merged 12 commits into
masterfrom
nv-mem-utils-2

Conversation

@NikVolf
Copy link
Copy Markdown
Contributor

@NikVolf NikVolf commented Dec 21, 2019

On top of #290

Copy link
Copy Markdown
Contributor

@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.

Changing malloc_size.rs means we essentially "fork" from the Servo version (we're at commit 5bdea7dc1c80790a852a3fb03edfb2b8fbd403dc).
That's not necessarily a problem but something we should be aware of (and clean up that code comment and maybe the readme?).

Comment thread parity-util-mem/tests/derive.rs Outdated
Comment thread parity-util-mem/tests/derive.rs
Comment thread parity-util-mem/derive/Cargo.toml Outdated
Comment thread parity-util-mem/Cargo.toml
@NikVolf
Copy link
Copy Markdown
Contributor Author

NikVolf commented Dec 30, 2019

@dvdplm addressed

Copy link
Copy Markdown
Contributor

@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.

A few minor nits and then there's the matter of testing #[ignore_malloc_size_of = …].

Comment thread parity-util-mem/src/malloc_size.rs Outdated
Comment thread parity-util-mem/src/malloc_size.rs Outdated
Copy link
Copy Markdown
Contributor

@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.

lgtm

@NikVolf
Copy link
Copy Markdown
Contributor Author

NikVolf commented Dec 31, 2019

@ordian @niklasad1 Hey guys can you also take a look?

Copy link
Copy Markdown
Contributor

@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.

AFAIR #[derive(MallocSizeOf)] actually worked if we renamed parity-util-mem to memory_size_of (example), but I agree it is a hack.

Comment thread parity-util-mem/derive/lib.rs
Comment thread parity-util-mem/tests/derive.rs
@NikVolf
Copy link
Copy Markdown
Contributor Author

NikVolf commented Dec 31, 2019

AFAIR #[derive(MallocSizeOf)] actually worked if we renamed parity-util-mem to memory_size_of (example), but I agree it is a hack.

Yeah, hacky, might bring some issues later

@NikVolf NikVolf merged commit 4612d11 into master Dec 31, 2019
@NikVolf NikVolf deleted the nv-mem-utils-2 branch December 31, 2019 16:03
@cheme
Copy link
Copy Markdown
Collaborator

cheme commented Jan 1, 2020

Lgtm too, about the way to include external module (parity-util-mem) into the derive macro, I like the current substrate way of doing thing (since we got the derive macro in our code base we can probably use it now): https://github.com/paritytech/substrate/blob/20a9b15cdbed4bf962a4447e8bfb812f766f2fbc/frame/support/procedural/tools/src/lib.rs#L34 (I do not remember to well how it works but it is actually well tested on substrate).
With the code forked, it may be also possible to add a serde like implementation for a specific field with a function (I remember some discussion about it and I am not sure it is worth the work).

@ordian
Copy link
Copy Markdown
Contributor

ordian commented Jan 1, 2020

With the code forked, it may be also possible to add a serde like implementation for a specific field with a function (I remember some discussion about it and I am not sure it is worth the work).

You mean #255? Yeah, it's possible to implement it now.

dvdplm added a commit that referenced this pull request Jan 14, 2020
* master: (27 commits)
  update parity-util-mem (#309)
  Update features and feature dependencies (#307)
  Use proper memory queries to rocksdb (#308)
  Draft version updates and changelog (#299)
  Use custom error type for `from_hex` (#305)
  Fix typo. (#303)
  kvdb: remove KeyValueDBHandler (#304)
  extract common kvdb tests into a crate (#301)
  Expose to_hex and from_hex from impl-serde (#302)
  Add a top level function to parity-util-mem (#298)
  I/O statistic for key-value databases (#294)
  use for_tuples (#300)
  Add memory extensions for LRUCache, hashbrown (#293)
  Add memory stats for kvdb-s (#292)
  Provide #[derive(MallocSizeOf)] that is actually working (#291)
  Move and extend impls for locking primitives (#290)
  Update uint README (#288)
  Update README.md (#287)
  [ci]: remove feature flags in virtual workspace (#289)
  Prepare releases (#286)
  ...
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