unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Stefan Israelsson Tampe <stefan.itampe@gmail.com>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: vhash speed thread safeness
Date: Tue, 29 Oct 2013 18:54:56 +0100	[thread overview]
Message-ID: <87zjpsnerz.fsf@gnu.org> (raw)
In-Reply-To: <CAGua6m3R1Y4i34-CekAhN5safW3R13wvP_HL5k93-cBpQ27zDw@mail.gmail.com> (Stefan Israelsson Tampe's message of "Tue, 29 Oct 2013 15:21:34 +0100")

Stefan Israelsson Tampe <stefan.itampe@gmail.com> skribis:

> On Tue, Oct 29, 2013 at 1:34 PM, Ludovic Courtès <ludo@gnu.org> wrote:
>
>> Hi, Stefan,
>>
>> Stefan Israelsson Tampe <stefan.itampe@gmail.com> skribis:
>>
>> > I did some tests witha C-based vhash implementation, it's possible to
>> > increse the speed by 30x compared to current vlist imlpementation in
>> > guile. It would be possible to get this speed today if one implemented
>> > vhash-assoc as a VM op. Anyway using the source as a standard lib will
>> > get you about 10x speed increase.
>>
>> As we discussed, I don’t really like the idea of implementing that much
>> in C.
>>
> My neither, but it is good to see that in cache friendly cases we can
> improve the situation 30x. Gives us a goal to strive for. Also the main
> intention is to use vashses for guile-log. For this we can note.

OK.

[...]

>> > Another pressing need is that vhashes are not thread safe,
>>
>> Section 2.8 of Bagwell’s paper proposes a simple solution.  All that is
>> missing AFAICS is an atomic test-and-set VM op to implement it (which
>> may also be useful in other places.)
>>
>> What do you think of this approach?
>
>
> For vlists it's probably a good idea, I don't know if it's enough for
> vhashes though.

Oooh, right, sorry for overlooking that.

> Maybe you need a mutex. But lock overhead will be significant

Surely, especially if it’s a fat mutex.

Hmm hmm.  Of course that could be an argument for doing some C
(primitives, not VM ops), but looking at ‘%vhash-assoc’, that would
clearly mean reimplementing pretty much all of the vlist + vhash in C,
which sucks.

I wonder if there’s some other data structure with similar properties
that doesn’t have the thread-safety issue.  Maybe Ian has an idea?

The weight-balanced trees in MIT/GNU Scheme look interesting:

  http://www.gnu.org/software/mit-scheme/documentation/mit-scheme-ref/Weight_002dBalanced-Trees.html

Thoughts?

Thanks,
Ludo’.



  reply	other threads:[~2013-10-29 17:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-18 16:21 vhash speed thread safeness Stefan Israelsson Tampe
2013-10-29 12:34 ` Ludovic Courtès
2013-10-29 14:21   ` Stefan Israelsson Tampe
2013-10-29 17:54     ` Ludovic Courtès [this message]
2013-10-29 18:50       ` Ian Price
2014-03-24 20:59 ` Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zjpsnerz.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guile-devel@gnu.org \
    --cc=stefan.itampe@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).