From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id CAA29173; Sat, 28 Jun 2003 02:47:52 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id CAA17648 for ; Sat, 28 Jun 2003 02:47:51 +0200 (MET DST) Received: from hotmail.com (bay1-dav22.bay1.hotmail.com [65.54.244.79]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h5S0loj06963 for ; Sat, 28 Jun 2003 02:47:50 +0200 (MET DST) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Fri, 27 Jun 2003 17:47:49 -0700 Received: from 81.50.183.112 by bay1-dav22.bay1.hotmail.com with DAV; Sat, 28 Jun 2003 00:47:49 +0000 X-Originating-IP: [81.50.183.112] X-Originating-Email: [seregrog@hotmail.com] From: "Zed Sereg" To: References: <001001c33ccc$5e878300$a806df80@chrisgd> <20030628.030009.92588696.yoriyuki@mbg.sphere.ne.jp> Subject: [Caml-list] Operation complexity Date: Sat, 28 Jun 2003 02:47:45 +0200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_01FB_01C33D1F.A769B8B0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Message-ID: X-OriginalArrivalTime: 28 Jun 2003 00:47:49.0491 (UTC) FILETIME=[E60C5430:01C33D0E] X-Spam: no; 0.00; zed:99 val:01 arrays:01 complexity:02 string:03 W3:96 let:04 vector:04 arial:95 array:04 slow:05 separately:05 structure:06 secs:06 fun:08 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk This is a multi-part message in MIME format. ------=_NextPart_000_01FB_01C33D1F.A769B8B0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello World, I have a obfuscating question, for whih I can found no = answer. I have to handle huge string arrays in a kind of database parsing.=20 At the end, i have a code of the shape :=20 let request_word s =3D ... val request_word : string -> string array list let associate v =3D let n =3D Array.length v in let v' =3D array.make n (request_word v.(0)) in for i =3D 1 to n-1 do v'.(i) <- (request_word v.(i)); done; v' ;; val associate : string array -> string array list array =3D Yeah, it 's obfuscating, but I had no time to find another solution.And = this is awfully slow... (In order to know, the computating time of each = request separately is around 2 secs. I waited 5 minutes for a call of = associate with a 3 elements vector.) I would like to know if there is a way to do the same thing, without = replacing a value in v' at each iteration. Would it really be better to = switch the structure from an array to a temporary list, and after, = copying the list into an array with Array.of_list. Thanks=20 Zed ------=_NextPart_000_01FB_01C33D1F.A769B8B0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hello World, I have a obfuscating = question, for=20 whih I can found no answer.
 
I have to handle huge string arrays in = a kind of=20 database parsing.
At the end, i have a code of the shape = :=20
let request_word s =3D ...
val request_word : string -> string = array=20 list
 
let associate v =3D
    let n =3D = Array.length v=20 in
    let v' =3D = array.make n=20 (request_word v.(0)) in
    for i =3D 1 to n-1 = do
        = v'.(i) <-=20 (request_word v.(i));
    done;
    v'
;;
 
val associate : string array -> = string array=20 list array =3D <fun>
 
Yeah, it 's obfuscating, but I had no = time to find=20 another solution.And this is awfully slow... (In order to know, the = computating=20 time of each request separately is around 2 secs. I waited 5 = minutes for a=20 call of associate with a 3 elements vector.)
 
I would like to know if there is a = way to do=20 the same thing, without replacing a value in v' at each iteration. Would = it=20 really be better to switch the structure from an array to a temporary = list, and=20 after, copying the list into an array with Array.of_list.
 
Thanks
 
Zed
 
 
------=_NextPart_000_01FB_01C33D1F.A769B8B0-- ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners