From: Bardur Arantsson <spam@scientician.net>
To: caml-list@inria.fr
Subject: Re: announce: callbacks-0.1
Date: Sat, 10 Sep 2005 09:31:48 +0200 [thread overview]
Message-ID: <dfu255$ag5$1@sea.gmane.org> (raw)
In-Reply-To: <43228592.1040800@inria.fr>
Xavier Leroy wrote:
>>From the implementation in globroots.c it would seem that
>>register_global_root is at least O(n) in the number of roots, and that
>>it has a large constant overhead compared to e.g. adding something to a
>>hashtable.
>
>
> You should look harder. register_global_root is insertion in a skip
> list, which is probabilistic O(log n) with a low constant. I don't
> think a hash table would perform significantly better for the mix of
> operations we need to do on the set of global roots (insertion,
> deletion, and enumeration for the GC).
>
D'oh, don't know how I could have missed that... Sorry for the
misinformation.
>
>>That depends hugely on what kind of library you're wrapping. I did a
>>wrapper for libevent (events on file descriptors and other similar stuff
>>like alarms, etc.) and what ended up happening was that a 1) lot of the
>>time a relatively large amount of callbacks were registered, orm 2)
>>callbacks would be registered/unregistered a lot. I did try using
>>*_global_roots in my libevent wrapper, but the performance was awful
>>until I changed it to use an (fd->callback) hashtable on the OCaml side.
>
>
> I would have been very interested in a profiling of your initial
> implementation. The only reason why the Caml hashtable can beat the
> global roots is that the latter are not generational: since the
> contents of registered global roots can change at any time without
> notifying the GC, all global roots must be scanned at every minor
> collection.
>
Unfortunately I haven't kept any of the benchmark results. Of course I
don't have old source to compile from either since this was before I put
it into version control :(. I supposed there's a lesson in there somewhere.
I'm not really motivated to attempt to reconstruct a benchmark for this
as 1) I've since moved to an event library which only uses short-lived
callbacks at the C/OCaml interface. 2) I just don't have the time.
Cheers,
--
Bardur Arantsson
<bardur@imada.sdu.dk>
<bardur@scientician.net>
- I'm a well-wisher... in that I don't wish you any *specific*
harm.
Moe, 'The Simpsons'
next prev parent reply other threads:[~2005-09-10 7:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-08 16:31 Christophe Raffalli
[not found] ` <4320A68E.1060608@xs4all.nl>
2005-09-08 21:24 ` [Caml-list] " Christophe Raffalli
2005-09-08 23:31 ` Bardur Arantsson
2005-09-09 6:30 ` Bardur Arantsson
2005-09-10 7:04 ` [Caml-list] " Xavier Leroy
2005-09-10 7:31 ` Bardur Arantsson [this message]
2005-09-10 13:04 ` Yaron Minsky
2005-09-10 21:02 ` caml_register_unmutable_global_root Christophe Raffalli
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='dfu255$ag5$1@sea.gmane.org' \
--to=spam@scientician.net \
--cc=caml-list@inria.fr \
/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