From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id CE5D7BC48 for ; Sun, 10 Apr 2005 05:30:55 +0200 (CEST) Received: from hotmail.com (bay102-f4.bay102.hotmail.com [64.4.61.14]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j3A3Us5W029665 for ; Sun, 10 Apr 2005 05:30:55 +0200 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Sat, 9 Apr 2005 20:30:54 -0700 Message-ID: Received: from 64.4.61.203 by by102fd.bay102.hotmail.msn.com with HTTP; Sun, 10 Apr 2005 03:30:53 GMT X-Originating-IP: [64.4.61.203] X-Originating-Email: [g_r_e_g_@hotmail.com] X-Sender: g_r_e_g_@hotmail.com From: "Gregory Guyomarc'h" To: caml-list@yquem.inria.fr Subject: Thread library (and camlimages) Date: Sun, 10 Apr 2005 05:30:53 +0200 Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-OriginalArrivalTime: 10 Apr 2005 03:30:54.0294 (UTC) FILETIME=[B393C760:01C53D7D] X-Miltered: at nez-perce with ID 42589DEE.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; guyomarc'h:01 camlimages:01 camlimages:01 ocamlopt:01 -version:01 ocamlopt:01 -thread:01 threads:01 lib:01 ocaml:01 -thread:01 threads:01 lib:01 ocaml:01 cmxa:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=MSGID_FROM_MTA_HEADER autolearn=disabled version=3.0.2 X-Spam-Level: Hello everyone, I don't understand the performance of a program that uses camlimages along with the thread library, also I don't really understand why the program throws an exception in the 3rd case (see below). I compiled the program with the following options: ocamlopt -version 3.08.3 ocamlopt -thread -I +threads -I ~/dev/godi/lib/ocaml/pkg-lib/camlimages -c test.ml ocamlopt -thread -I +threads -I ~/dev/godi/lib/ocaml/pkg-lib/camlimages unix.cmxa threads.cmxa ci_core.cmxa ci_bmp.cmxa test.cmx -o test.opt >>Beginning of test.ml open OImages (* LINE1 *) let _ = Printf.printf "Thread: %d\n" (Thread.id (Thread.self ())) (* LINE2 *) let dummy () = Thread.delay 0.001 let files = ref [] let _ = Arg.parse [] (fun s -> files := s :: !files) "" let load_image file = Printf.printf "Loading image: %s\n" file; flush stdout; let image = try match tag (OImages.load file []) with | Rgb24 i -> i | Index8 i -> i#to_rgb24 | Index16 i -> i#to_rgb24 | _ -> failwith "unsupported image file format" with | e -> prerr_endline (Printexc.to_string e); raise e in image; ;; let images = List.map load_image (List.rev !files) << End of test.ml Case 1, with LINE1 and LINE2: time ./test.opt image.0[1-9].bmp real 0m8.129s user 0m8.103s sys 0m0.019s Case 2, without LINE1 and without lINE2: time ./test.opt image.0[1-9].bmp real 0m0.440s user 0m0.381s sys 0m0.019s Case 3, with LINE1 and without LINE2: time ./test.opt image.0[1-9].bmp Thread: Fatal error: exception Invalid_argument("Thread.self: not initialized") Any idea about what's going on here ? Thanks. Gregory Guyomarc'h.