<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/concurrent_set.c, branch v4.0.2</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>Fix typo and shadowing</title>
<updated>2025-12-10T06:48:06+00:00</updated>
<author>
<name>John Hawthorn</name>
<email>john@hawthorn.email</email>
</author>
<published>2025-12-09T23:42:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=375025a3864fc944dc9f42909a6c5386c749d5fd'/>
<id>375025a3864fc944dc9f42909a6c5386c749d5fd</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Attempt to reuse garbage slots in concurrent hash</title>
<updated>2025-12-10T06:48:06+00:00</updated>
<author>
<name>John Hawthorn</name>
<email>john@hawthorn.email</email>
</author>
<published>2025-12-09T10:17:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=462df17f8689e9ee87a45b88bb3283fd339e1247'/>
<id>462df17f8689e9ee87a45b88bb3283fd339e1247</id>
<content type='text'>
This removes all allocations from the find_or_insert loop, which
requires us to start the search over after calling the provided create
function.

In exchange that allows us to assume that all concurrent threads insert
will get the same view of the GC state, and so should all be attempting
to clear and reuse a slot containing a garbage object.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This removes all allocations from the find_or_insert loop, which
requires us to start the search over after calling the provided create
function.

In exchange that allows us to assume that all concurrent threads insert
will get the same view of the GC state, and so should all be attempting
to clear and reuse a slot containing a garbage object.
</pre>
</div>
</content>
</entry>
<entry>
<title>Use continuation bit in concurrent set</title>
<updated>2025-12-10T06:48:06+00:00</updated>
<author>
<name>John Hawthorn</name>
<email>john@hawthorn.email</email>
</author>
<published>2025-11-25T00:50:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=81fbdff8fdf2ae7afb2fa19319ff7d40379521fe'/>
<id>81fbdff8fdf2ae7afb2fa19319ff7d40379521fe</id>
<content type='text'>
This refactors the concurrent set to examine and reserve a slot via CAS
with the hash, before then doing the same with the key.

This allows us to use an extra bit from the hash as a "continuation bit"
which marks whether we have ever probed past this key while inserting.
When that bit isn't set on deletion we can clear the field instead of
placing a tombstone.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This refactors the concurrent set to examine and reserve a slot via CAS
with the hash, before then doing the same with the key.

This allows us to use an extra bit from the hash as a "continuation bit"
which marks whether we have ever probed past this key while inserting.
When that bit isn't set on deletion we can clear the field instead of
placing a tombstone.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fixed by `misspell -w -error -source=text`</title>
<updated>2025-12-09T08:48:57+00:00</updated>
<author>
<name>Hiroshi SHIBATA</name>
<email>hsbt@ruby-lang.org</email>
</author>
<published>2025-12-09T08:22:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=79c57d747f7d1e6253a6df7b624a9930cb8a523c'/>
<id>79c57d747f7d1e6253a6df7b624a9930cb8a523c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Change load factor of concur. set from 0.5 to 0.75 (#15007)</title>
<updated>2025-10-30T21:14:36+00:00</updated>
<author>
<name>Luke Gruber</name>
<email>luke.gru@gmail.com</email>
</author>
<published>2025-10-30T21:14:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=2afcdc6902971c3662f5d032ee1a25136e07a465'/>
<id>2afcdc6902971c3662f5d032ee1a25136e07a465</id>
<content type='text'>
Before, the 50% load factor was not working correctly with the new capacity
calculation on resize and too many resizes were seen.

Before this change
------------------

Example:

old_capacity = 32
old_size = 16
deleted_entries = 2 (almost all live)

That means we have:
expected_size = 14
We'll see that 64 &gt; 14 * 4

We'll end up using 32 as the new capacity (same as old) even though that only
leaves us two elements free before we'd have to rebuild again.

Co-authored-by: John Hawthorn &lt;john.hawthorn@shopify.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Before, the 50% load factor was not working correctly with the new capacity
calculation on resize and too many resizes were seen.

Before this change
------------------

Example:

old_capacity = 32
old_size = 16
deleted_entries = 2 (almost all live)

That means we have:
expected_size = 14
We'll see that 64 &gt; 14 * 4

We'll end up using 32 as the new capacity (same as old) even though that only
leaves us two elements free before we'd have to rebuild again.

Co-authored-by: John Hawthorn &lt;john.hawthorn@shopify.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>Use explicit memory orders in concurrent_set</title>
<updated>2025-10-16T01:21:52+00:00</updated>
<author>
<name>John Hawthorn</name>
<email>john@hawthorn.email</email>
</author>
<published>2025-07-22T16:40:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=45c016866c24a244d286a2db0babab1ff6867ba0'/>
<id>45c016866c24a244d286a2db0babab1ff6867ba0</id>
<content type='text'>
The atomic load/store operations here should mostly be using
release/acquire semantics. This may lead to better performance than what
we had under the default seq_cst.

On x86 this may make the atomic store of hash faster, as it can avoid
xchg. On ARM the loads may be faster (depending on target CPU for the
compiler).

Reference for comparison of atomic operations
https://godbolt.org/z/6EdaMa5rG
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The atomic load/store operations here should mostly be using
release/acquire semantics. This may lead to better performance than what
we had under the default seq_cst.

On x86 this may make the atomic store of hash faster, as it can avoid
xchg. On ARM the loads may be faster (depending on target CPU for the
compiler).

Reference for comparison of atomic operations
https://godbolt.org/z/6EdaMa5rG
</pre>
</div>
</content>
</entry>
<entry>
<title>Add ASSERT_vm_locking_with_barrier</title>
<updated>2025-10-10T18:09:34+00:00</updated>
<author>
<name>John Hawthorn</name>
<email>john@hawthorn.email</email>
</author>
<published>2025-10-10T00:09:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=0a6cd03b3d91f52c47242d2b45f5ac086a3c1fd8'/>
<id>0a6cd03b3d91f52c47242d2b45f5ac086a3c1fd8</id>
<content type='text'>
Previously we just had a comment stating that the code required a
barrier. Turns out it's not too difficult to properly assert that.

Co-authored-by: Luke Gruber &lt;luke.gru@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously we just had a comment stating that the code required a
barrier. Turns out it's not too difficult to properly assert that.

Co-authored-by: Luke Gruber &lt;luke.gru@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Allow concurrent_set to be collected in minor GC</title>
<updated>2025-09-10T20:25:24+00:00</updated>
<author>
<name>John Hawthorn</name>
<email>john@hawthorn.email</email>
</author>
<published>2025-09-10T16:09:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=399e2abc4380857134af9f0b037a4723157d14de'/>
<id>399e2abc4380857134af9f0b037a4723157d14de</id>
<content type='text'>
When testing we've found that the concurrent_set objects used for
fstrings can grow quite large, and because they reach oldgen quickly end
up not being collected.

This commit is a bit of a hack but aims to improve that by moving the
objects to not be WB_PROTECTED. "Unprotected" objects do not age and
can't become oldgen, so this allows them to be collected in a minor GC.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When testing we've found that the concurrent_set objects used for
fstrings can grow quite large, and because they reach oldgen quickly end
up not being collected.

This commit is a bit of a hack but aims to improve that by moving the
objects to not be WB_PROTECTED. "Unprotected" objects do not age and
can't become oldgen, so this allows them to be collected in a minor GC.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix missing increment of deleted_entries</title>
<updated>2025-07-22T14:05:24+00:00</updated>
<author>
<name>Kunshan Wang</name>
<email>wks1986@gmail.com</email>
</author>
<published>2025-07-17T14:44:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=0f408602cbcdc33faf4e2b545a7b62718e401807'/>
<id>0f408602cbcdc33faf4e2b545a7b62718e401807</id>
<content type='text'>
When `rb_concurrent_set_foreach_with_replace` deletes entries from a
concurrent set, it should increment the `deleted_entries` field, too.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When `rb_concurrent_set_foreach_with_replace` deletes entries from a
concurrent set, it should increment the `deleted_entries` field, too.
</pre>
</div>
</content>
</entry>
<entry>
<title>Don't rehash on retry in concurrent set</title>
<updated>2025-07-21T14:58:30+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2025-07-18T22:03:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=6b0e5de4e68bc60c10ce7974cb69f246678a9512'/>
<id>6b0e5de4e68bc60c10ce7974cb69f246678a9512</id>
<content type='text'>
Since the hash should never change, we only need to calculate it once.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since the hash should never change, we only need to calculate it once.
</pre>
</div>
</content>
</entry>
</feed>
