caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Romain Beauxis <toots@rastageeks.org>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] enter_blocking_section() and string modifications
Date: Wed, 2 Apr 2008 09:13:47 +0100	[thread overview]
Message-ID: <200804020913.47767.toots@rastageeks.org> (raw)
In-Reply-To: <47F30AF3.1070100@gmail.com>

Le Wednesday 02 April 2008 05:26:27 Reed Wilson, vous avez écrit :
> > Here is a snippet from ml_gpointer.c, in lablgtk, which copies an
> > abstract block to the old heap when it is young. Such a block is then
> > stable as long as there is no compaction.
> >
> > CAMLprim value ml_stable_copy (value v)
> > {
> >     if (Is_block(v) && (char*)(v) < young_end && (char*)(v) >
> > young_start) {
> >         CAMLparam1(v);
> >         mlsize_t i, wosize = Wosize_val(v);
> >         int tag = Tag_val(v);
> >         value ret;
> >         if (tag < No_scan_tag) invalid_argument("ml_stable_copy");
> >         ret = alloc_shr (wosize, tag);
> >         for (i=0; i < wosize; i++) Field(ret,i) = Field(v,i);
> >         CAMLreturn(ret);
> >     }
> >     return v;
> > }
> >
> > Jacques Garrigue
>
> Thanks! That's exactly what I needed to know. All of my strings are
> around 8MB, so they'll all be allocated directly on the old heap. I'll
> test to see how much memory is used up by disabling compaction.
>
> And in this case, the concurrency is definitely worth it. With 2 threads
> and 2 processors, using enter_blocking_section() raises CPU usage from
> ~50% (i.e. 100% of 1 processor) to ~75%, with a corresponding increase
> in throughput.

Isn't it possible to register a global variable for that purpose ?


Romain
-- 
He say 'im that he's the first one
Who discover Jamaica, I an' I say that:
What about the Awarak indians ?


      reply	other threads:[~2008-04-02  8:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-02  3:13 Reed Wilson
2008-04-02  4:02 ` [Caml-list] " Jacques Garrigue
2008-04-02  4:26   ` Reed Wilson
2008-04-02  8:13     ` Romain Beauxis [this message]

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=200804020913.47767.toots@rastageeks.org \
    --to=toots@rastageeks.org \
    --cc=caml-list@yquem.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;
as well as URLs for NNTP newsgroup(s).