I was interested to see if I could determine what was happening with this.  After some playing around, I noticed the code was running significantly faster if I *didn&#39;t* compile it, but ran it with &#39;runghc&#39; instead (running under ghci was also fast).<br>
<br>Here are the running times I found.  The &#39;Zip.hs&#39; program comes with the zip-archive package.  The runtime of the compiled version didn&#39;t seem to be affected by optimisations.  Regardless, I&#39;m quite surprised running interpreted was significantly faster than compiled.<br>
<br>&gt; time runghc ./Zip.hs -l ~/jdk1.6.0_05-src.zip<br> 1.48s user 0.17s system 97% cpu 1.680 total<br><br>&gt; time ./dist/build/Zip/Zip -l ~/jdk1.6.0_05-src.zip <br> 89.00s user 1.06s system 98% cpu 1:31.84 total<br>
<br>The file &#39;jdk1.6.0_05-src.zip&#39; was just an 18MB zip file I had lying around.  I&#39;m using ghc 6.12.1<br><br>Cheers,<br><br clear="all">-- <br>David Powell<br>
<br><br><div class="gmail_quote">On Tue, Aug 10, 2010 at 12:10 PM, Jason Dagit <span dir="ltr">&lt;<a href="mailto:dagit@codersbase.com">dagit@codersbase.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br><br><div class="gmail_quote"><div class="im">On Mon, Aug 9, 2010 at 4:29 PM, Pieter Laeremans <span dir="ltr">&lt;<a href="mailto:pieter@laeremans.org" target="_blank">pieter@laeremans.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

Hello,<br><br>I&#39;m trying some haskell scripting. I&#39;m writing a script to print some information <br>from a zip archive.  The zip-archive library does look nice but the performance of zip-archive/lazy bytestring <br>


doesn&#39;t seem to scale.<br><br>Executing : <br><br>   eRelativePath $ head $ zEntries archive    <br><br>on an archive of around 12 MB with around 20 files yields <br><br>Stack space overflow: current size 8388608 bytes.<br>

</blockquote><div><br></div></div><div>So it&#39;s a stack overflow at about 8 megs.  I don&#39;t have a strong sense of what is normal, but that seems like a small stack to me.  Oh, actually I just check and that is the default stack size :)</div>

<div><br></div><div>I looked at Zip.hs (included as an example).  The closest I see to your example is some code for listing the files in the archive.  Perhaps you should try the supplied program on your archive and see if it too has a stack overflow.</div>

<div><br></div><div>The line the author uses to list files is:</div><div>List        -&gt; mapM_ putStrLn $ filesInArchive archive</div><div><br></div><div>But, you&#39;re taking the head of the entries, so I don&#39;t see how you&#39;d be holding on to too much data.  I just don&#39;t see anything wrong with your program.  Did you remember to compile with optimizations?  Perhaps try the author&#39;s way of listing entries and see if performance changes?</div>
<div class="im">
<div><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br><br>The script in question can be found at :<br><br><a href="http://github.com/plaeremans/HaskellSnipplets/blob/master/ZipList.hs" target="_blank">http://github.com/plaeremans/HaskellSnipplets/blob/master/ZipList.hs</a><br clear="all">


<br>I&#39;m using the latest version of haskell platform.  Are these libaries not production ready, <br>or am I doing something terribly wrong ? <br></blockquote><div><br></div></div><div>Not production ready would be my assumption.  I think an iteratee style might be more appropriate for these sorts of nested streams of potentially large size anyway.  I&#39;m skeptical of anything that depends on lazy bytestrings or lazy io.  In this case, the performance would appear to be depend on lazy bytestrings.</div>

<div><br></div><div>You might want to experiment with increasing the stack size.  Something like this:</div><div>./ZipList +RTS -K100M -RTS foo.zip</div><div><br></div><font color="#888888"><div>Jason</div></font></div>
<br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br>