Skip to content

Replace use of _id2ref in DRb.#2102

Closed
headius wants to merge 3 commits into
ruby:masterfrom
headius:drb_without_id2ref_1
Closed

Replace use of _id2ref in DRb.#2102
headius wants to merge 3 commits into
ruby:masterfrom
headius:drb_without_id2ref_1

Conversation

@headius

@headius headius commented Mar 19, 2019

Copy link
Copy Markdown
Contributor

This implementation uses the weakref library to implement a simple weak mapping atop a normal Hash. Access to that Hash is guarded by a Mutex.

This is the initial proposed implementation for https://bugs.ruby-lang.org/issues/15711

headius added 2 commits March 19, 2019 11:15
This implementation must periodically "clean" stale references
out of the underlying Hash, which requires an O(n) search.
To reduce the chance of this search happening, it only runs when
inserting a new entry into the weak mapping. Stale entries that
are discovered while retrieving entries are deleted individually.
@znz

znz commented Mar 28, 2019

Copy link
Copy Markdown
Member

I think Mutex#synchronize is better than Mutex#lock and Mutex#unlock in ensure.

@headius

headius commented Apr 12, 2019

Copy link
Copy Markdown
Contributor Author

@znz I wanted _get to be as low-overhead has possible, and blocks add overhead or optimization complexity on all Ruby impls. It would seem odd to do it differently in _put so they both skip the block and do the ensure form.

@k0kubun
k0kubun changed the base branch from trunk to master August 15, 2019 17:18
@k0kubun
k0kubun requested a review from seki December 31, 2019 09:04
@nobu nobu closed this Mar 31, 2026
@hsbt

hsbt commented Mar 31, 2026

Copy link
Copy Markdown
Member

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.

5 participants