From: "Gregory Guyomarc'h" <g_r_e_g_@hotmail.com>
To: caml-list@yquem.inria.fr
Subject: Thread library (and camlimages)
Date: Sun, 10 Apr 2005 05:30:53 +0200 [thread overview]
Message-ID: <BAY102-F47C34F01985C22FAEA4BDD8310@phx.gbl> (raw)
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.
reply other threads:[~2005-04-10 3:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=BAY102-F47C34F01985C22FAEA4BDD8310@phx.gbl \
--to=g_r_e_g_@hotmail.com \
--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).