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 WAA27359; Wed, 8 Oct 2003 22:34:41 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA29610; Wed, 8 Oct 2003 22:34:40 +0200 (MET DST) From: Pierre Weis Message-Id: <200310082034.WAA29610@pauillac.inria.fr> Subject: Re: [Caml-list] what is the functional way to solve this problem? In-Reply-To: <20031008160915.GA4730@roke.freak> from Michal Moskal at "Oct 8, 103 06:09:15 pm" To: malekith@pld-linux.org (Michal Moskal) Date: Wed, 8 Oct 2003 22:34:40 +0200 (MET DST) Cc: pierre.weis@inria.fr, ramb@sonic.net, caml-list@pauillac.inria.fr X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Loop: caml-list@inria.fr X-Spam: no; 0.00; pierre:01 weis:01 weis:01 caml-list:01 slower:01 scanf:01 bscanf:01 scanf:01 filenames:01 filenames:01 slower:01 exhibit:01 pld-linux:01 ocamlopt:01 -unsafe:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk [...] > Hm, with your version it's only 3 times slower: [...] > However, your code is not correct: > > Scanf.bscanf Scanf.Scanning.stdib " %d %d %s" > ----------------------------------------------------^^ > > It should be [^\n], as filenames can contain spaces. In this case: I did not know the complete specification :) However, your proposed patch is rather inefficient: > It should be [^\n], as filenames can contain spaces. In this case: ---------------^^^^^ You should prefer %s@\n, if efficiency is a concern (which since to be the case :) > Well, it's 15 times slower. Could you please let me have access to the data to be able to test the code without bothering you ? Thank you very much indeed for your testbed case, since you exhibit situations where there is room for improvement in the implementation of scanf (or at least there is the necessity to explain what are the efficient pattern constructs for Scanf). > All tests were run on athlon 1.56GHz, under pld-linux, ocaml 3.07, > ocamlopt -unsafe -inline 9. > -- > : Michal Moskal :: http://www.kernel.pl/~malekith : GCS {C,UL}++++$ a? !tv > : When in doubt, use brute force. -- Ken Thompson : {E-,w}-- {b++,e}>+++ h Thanks for the precision. I use a (now old) 700MHZ pentium III, but since we just compare the efficiency of different versions of the same program, I think that the machine hardware kind is not critical. Best regards, Pierre Weis INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/ ------------------- 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