<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/10/f0d7a9095f1a80f5d23897d58bf50d50"
  from="Pierre Weis &lt;weis@p...&gt;"
  author="Pierre Weis"
  date="2003-10-08T20:34:41"
  subject="Re: [Caml-list] what is the functional way to solve this problem?"
  prev="2003/10/e0230805f657be23a6ddcabf6e9064b3"
  next="2003/10/23020cf3ef994a55faf67bc004acf3fd"
  prev-in-thread="2003/10/899d22452db6890e8647fbc2d53d9ee4"
  next-in-thread="2003/10/0ee5858b073f26c4cbcaef3bc64f2a02"
  prev-thread="2003/10/261f050dccf87201bc913df1d656bf10"
  next-thread="2003/10/9a4a4be0cfe7c019ae4f42aaf4c47b30"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] what is the functional way to solve this problem?">
<msg 
  url="2003/10/af98552ca0ffbadca25a0ba23600da76"
  from="Ram Bhamidipaty &lt;ramb@s...&gt;"
  author="Ram Bhamidipaty"
  date="2003-10-02T12:41:52"
  subject="[Caml-list] what is the functional way to solve this problem?">
<msg 
  url="2003/10/01f8985812016e242ddd8d73bc92ef59"
  from="Michal Moskal &lt;malekith@p...&gt;"
  author="Michal Moskal"
  date="2003-10-02T14:55:22"
  subject="Re: [Caml-list] what is the functional way to solve this problem?">
<msg 
  url="2003/10/7f88e86b9d298b383d73b6b58f84f6fb"
  from="Pierre Weis &lt;weis@p...&gt;"
  author="Pierre Weis"
  date="2003-10-08T14:48:11"
  subject="Re: [Caml-list] what is the functional way to solve this problem?">
<msg 
  url="2003/10/899d22452db6890e8647fbc2d53d9ee4"
  from="Michal Moskal &lt;malekith@p...&gt;"
  author="Michal Moskal"
  date="2003-10-08T16:10:14"
  subject="Re: [Caml-list] what is the functional way to solve this problem?">
<msg 
  url="2003/10/f0d7a9095f1a80f5d23897d58bf50d50"
  from="Pierre Weis &lt;weis@p...&gt;"
  author="Pierre Weis"
  date="2003-10-08T20:34:41"
  subject="Re: [Caml-list] what is the functional way to solve this problem?">
<msg 
  url="2003/10/0ee5858b073f26c4cbcaef3bc64f2a02"
  from="Michal Moskal &lt;malekith@p...&gt;"
  author="Michal Moskal"
  date="2003-10-08T21:25:11"
  subject="scanf (Re: [Caml-list] what is the functional way to solve this problem?)">
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</thread>

<contents>
[...]
&gt; Hm, with your version it's only 3 times slower:
[...]
&gt; However, your code is not correct:
&gt; &gt;         Scanf.bscanf Scanf.Scanning.stdib " %d %d %s"
&gt; ----------------------------------------------------^^
&gt; 
&gt; 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:

&gt; 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 :)

&gt; 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).

&gt; All tests were run on athlon 1.56GHz, under pld-linux, ocaml 3.07,
&gt; ocamlopt -unsafe -inline 9.
&gt; -- 
&gt; : Michal Moskal :: http://www.kernel.pl/~malekith : GCS {C,UL}++++$ a? !tv
&gt; : When in doubt, use brute force. -- Ken Thompson : {E-,w}-- {b++,e}&gt;+++ 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

</contents>

</message>

