caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Zed Sereg" <seregrog@hotmail.com>
To: <caml-list@inria.fr>
Subject: [Caml-list] Operation complexity
Date: Sat, 28 Jun 2003 02:47:45 +0200	[thread overview]
Message-ID: <BAY1-DAV2269QbwyJR50002a294@hotmail.com> (raw)
In-Reply-To: <20030628.030009.92588696.yoriyuki@mbg.sphere.ne.jp>

[-- Attachment #1: Type: text/plain, Size: 1060 bytes --]

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. 
At the end, i have a code of the shape : 
let request_word s = ...
val request_word : string -> string array list

let associate v =
    let n = Array.length v in
    let v' = array.make n (request_word v.(0)) in
    for i = 1 to n-1 do
        v'.(i) <- (request_word v.(i));
    done;
    v'
;;

val associate : string array -> string array list array = <fun>

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 

Zed


[-- Attachment #2: Type: text/html, Size: 2646 bytes --]

  reply	other threads:[~2003-06-28  0:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-27 16:51 [Caml-list] scripting ocaml from inside of ocaml Chris GauthierDickey
2003-06-27 18:00 ` Yamagata Yoriyuki
2003-06-28  0:47   ` Zed Sereg [this message]
2003-06-28  1:17     ` [Caml-list] Operation complexity Karl Zilles
2003-07-01  9:47 ` [Caml-list] scripting ocaml from inside of ocaml Jean-Christophe Filliatre

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=BAY1-DAV2269QbwyJR50002a294@hotmail.com \
    --to=seregrog@hotmail.com \
    --cc=caml-list@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).