3 ms·
You won't see the problem with refcounting in microbenchmarks. It manifests when you have multiple threads accessing single pieces of data, or are under memory
by rwmj 3y ago
You won't see the problem with refcounting in microbenchmarks. It manifests when you have multiple threads accessing single pieces of data, or are under memory pressure. Refcounting turns reads into writes, unless steps are taken to avoid that, and/or you store the refcounts separately from the data.
- FeepingCreature 3y agoMultiple threads accessing single pieces of data is always slow. The standard answer is "don't do that"; you can do that just as well with GC or manual management.
- rwmj 3y agoConfirming you have no idea what you're talking about.
- kragen 3y agoas i understand it, multiple threads reading single pieces of data is faster than multiple threads reading different copies of the same data, as long as you don't have to lock them or increment their reference counts. it's faster because it reduces cache pressure. rcu is a widely used, highly performant way for many threads to read single pieces of data without having to lock them even if they might change. often you can even implement garbage collection without having to acquire readlocks on garbage-collectable things