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.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id C570BBC68 for ; Wed, 25 Oct 2006 17:49:20 +0200 (CEST) Received: from smeltpunt.science.ru.nl (smeltpunt.science.ru.nl [131.174.16.145]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k9PFnKYl007513 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Wed, 25 Oct 2006 17:49:20 +0200 Received: from tandem.cs.ru.nl [131.174.142.18] (helo=tandem.cs.ru.nl) by smeltpunt.science.ru.nl (8.13.7/5.10) with ESMTP id k9PFnHpr002285 for ; Wed, 25 Oct 2006 17:49:17 +0200 (MEST) Received: from tews by tandem.cs.ru.nl with local (Exim 4.63) (envelope-from ) id 1Gcl0H-0006Xh-JG for caml-list@inria.fr; Wed, 25 Oct 2006 17:49:17 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17727.34685.561877.977822@tandem.cs.ru.nl> Date: Wed, 25 Oct 2006 17:49:17 +0200 To: caml-list@inria.fr Subject: caml_oldify_local_roots takes 50% of the total runtime X-Mailer: VM 7.19 under Emacs 21.4.1 From: Hendrik Tews X-Scanned-By: MIMEDefang 2.56 on 131.174.16.145 X-Miltered: at concorde with ID 453F8780.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; oldify:01 runtime:01 hendrik:01 tews:01 tews:01 oldify:01 ocaml:01 nodes:01 ocaml:01 nodes:01 node:01 marshaled:01 runtime:01 damien:01 node:01 Hi, I have an application (olmar[1]) for gprof tells me Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls s/call s/call name 58.33 9.52 9.52 caml_oldify_local_roots that is more than half of the time is spent in caml_oldify_local_roots. The trouble is, there is no significant garbage to collect. If I could, I would switch off garbage collection completely. The ocaml part of the application takes a big tree (353040 nodes in the profiled case) in C++ and translates it into ocaml. Some nodes are shared in the tree and there are also circles, therefore, every C++ node has caml_global_root for its ocaml relative (so 350.000 caml_global_roots). When the ocaml tree is ready it is marshaled to disk and the application exits (no need to collect garbage). To improve the runtime I set space_overhead to max_int, but this didn't change much (profiling above is with max_int). Apparently, space_overhead doesn't have really have an influence on allocate-only programs. Finally I increase minor_heap_size until the minor collections came down to one. This brought the ocaml running time down from 5.7s to 1.3s. Is there a way to adopt the size of minor heap to the program behaviour? (BTW 32K default minor heap sounds like 1995, not like 2006) >>From the comments of Damien Doligez in a related thread in http://caml.inria.fr/pub/ml-archives/caml-list/2004/07/84cd291931627c13faf56a259026885c.en.html I got the impression that there is extra punishment for caml_local_roots. Should the situation improve if I organize the 350.000 ocaml node pointers on the ocaml side via one local root (asumming this information is needed not so often)? Bye, Hendrik [1] http://www.cs.ru.nl/~tews/olmar/