(If that seems surprising, the reason is mentioned in the sibling c++ 
library announcement:
"performance in these cases is effectively governed by the number of cache 
misses, not the number of key-compare operations" 
-- 
https://opensource.googleblog.com/2013/01/c-containers-that-save-memory-and-time.html
 
... so the game turns into how few pointers you can chase. Turns out in 
memory b-trees are great for this.
On Friday, March 14, 2025 at 6:09:56 AM UTC Jason E. Aten wrote:

> I do keep seeing references to Java concurrent stuff people are porting to 
> Go. I have to check it out.
>
> I need an ordered k/v store (find the next key greater-than)... and I was 
> trying to see how
> concurrency could be added to things like https://github.com/google/btree, 
> which, in
> turns out, at least in single goroutine form, wipes the floor soundly 
> against red-black
> trees and radix trees. It's even way faster than the built in Go map, 
> while giving ordered key lookup,
> not just hash table operations. The only trade-off is that it is suuuuper 
> slow for deletes.
>
> On Friday, March 14, 2025 at 5:32:08 AM UTC Robert Engels wrote:
>
>> I know some people are put off by stuff like this, but reading the Java 
>> JDK concurrent package provides a wealth of information- it is well 
>> documented and almost all are referenced implementations of academic 
>> papers. In this case, the Java concurrent hash map would be an applicable 
>> design. 
>>
>> You can see some of this - not nearly as good or complete - in my 
>> github.com/robaho/go-concurrency-test
>>
>> On Mar 14, 2025, at 12:17 AM, Jason E. Aten <j.e....@gmail.com> wrote:
>>
>> oh nice. I like the hashing idea to pick a shard lock out of 
>> array...that way
>>
>> I don't have to stick locks on, and bloat, every node in the btree. I can
>> just take the hash value modulo a the size of a fixed set of locks... 
>> Thanks Robert.
>>
>> p.s. awl, thanks, yes... saw that. thank you.
>>
>> On Friday, March 14, 2025 at 4:29:46 AM UTC Robert Engels wrote:
>>
>>> I think it is easier to just hash and shard the data set the lock is 
>>> protecting - ie a lock per shard. 
>>>
>>> On Mar 13, 2025, at 10:52 PM, atomly <ato...@gmail.com> wrote:
>>>
>>> 
>>>
>>> On Thu, Mar 13, 2025 at 20:29 Jason E. Aten <j.e....@gmail.com> wrote:
>>>
>>>> Is there a common way to do sharded read-write locks now?
>>>> I mean faster than sync.RWMutex.
>>>>
>>>> I tried https://github.com/jonhoo/drwmutex which is from quite a
>>>> while back...
>>>>
>>>
>>> Have you read the original thread that spawned this, you might find it 
>>> pretty informative if not:
>>>
>>>
>>> https://groups.google.com/g/golang-nuts/c/zt_CQssHw4M/m/TteNG44geaEJ?pli=1
>>>
>>>
>>> -awl
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "golang-nuts" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to golang-nuts...@googlegroups.com.
>>> To view this discussion visit 
>>> https://groups.google.com/d/msgid/golang-nuts/CAA_Y42wUOYwnaO0ZDyC2USCMsZqVQXGck9q%2Bfb8inWoxG01brA%40mail.gmail.com
>>>  
>>> <https://groups.google.com/d/msgid/golang-nuts/CAA_Y42wUOYwnaO0ZDyC2USCMsZqVQXGck9q%2Bfb8inWoxG01brA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts...@googlegroups.com.
>>
>> To view this discussion visit 
>> https://groups.google.com/d/msgid/golang-nuts/08738a3e-2c94-4f52-8f49-16b287303c6bn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/golang-nuts/08738a3e-2c94-4f52-8f49-16b287303c6bn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/d3081e16-37f2-4509-95d6-9cbd32bb38ebn%40googlegroups.com.

Reply via email to