remem icon indicating copy to clipboard operation
remem copied to clipboard

Remove lifetime from `ItemGuard`

Open oblique opened this issue 6 years ago • 2 comments

Since inner object is Arc, lifetime is not needed.

This enables more flexible usage, for example sending an ItemGuard<T> via a channel.

oblique avatar Nov 22 '19 12:11 oblique

This looks good! Do we know if having to clone the underlying arc on every get has any performance impact? I would assume it's negligible, but might be worth looking into.

rylev avatar Nov 22 '19 12:11 rylev

Added a benchmark for Pool::get. Each get before my commits costs ~54 ns, after my commits it costs ~66 ns.

With reference:

test remem::get               ... bench:      54,504 ns/iter (+/- 764)

With Arc:

test remem::get               ... bench:      66,326 ns/iter (+/- 317)

oblique avatar Nov 23 '19 10:11 oblique