From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 9BD0FBBCA for ; Wed, 2 Apr 2008 10:13:53 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAJrD8kdYvxGE/2dsb2JhbACsGg X-IronPort-AV: E=Sophos;i="4.25,592,1199660400"; d="scan'208";a="9090497" Received: from www.rastageeks.org (HELO mail.rastageeks.org) ([88.191.17.132]) by mail2-smtp-roc.national.inria.fr with ESMTP; 02 Apr 2008 10:13:53 +0200 Received: from [192.168.112.144] (sphinx.lix.polytechnique.fr [129.104.11.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.rastageeks.org (Postfix) with ESMTP id A10BE9B69F for ; Wed, 2 Apr 2008 10:13:48 +0200 (CEST) From: Romain Beauxis 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 User-Agent: KMail/1.9.9 References: <47F2F9BC.4020502@gmail.com> <20080402.130205.125897873.garrigue@math.nagoya-u.ac.jp> <47F30AF3.1070100@gmail.com> In-Reply-To: <47F30AF3.1070100@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200804020913.47767.toots@rastageeks.org> X-Spam: no; 0.00; lablgtk:01 compaction:01 camlprim:01 camlparam:01 mlsize:01 wosize:01 wosize:01 val:01 val:01 alloc:01 camlreturn:01 compaction:01 jamaica:98 threads:01 char:01 Le Wednesday 02 April 2008 05:26:27 Reed Wilson, vous avez =C3=A9crit=C2=A0: > > 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) > > { > > =C2=A0 =C2=A0 if (Is_block(v) && (char*)(v) < young_end && (char*)(v) > > > young_start) { > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 CAMLparam1(v); > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 mlsize_t i, wosize =3D Wosize_val(v); > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 int tag =3D Tag_val(v); > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 value ret; > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (tag < No_scan_tag) invalid_argument("ml= _stable_copy"); > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D alloc_shr (wosize, tag); > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 for (i=3D0; i < wosize; i++) Field(ret,i) = =3D Field(v,i); > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 CAMLreturn(ret); > > =C2=A0 =C2=A0 } > > =C2=A0 =C2=A0 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 =2D-=20 He say 'im that he's the first one Who discover Jamaica, I an' I say that: What about the Awarak indians ?