Re: Perl Quiz of the Week #23

Matthew Walton <[email protected]>
Newsgroups gmane.comp.lang.perl.qotw.discuss
Message-ID <[email protected]>
This is quite telling... same algorithm, just replacing the output 
command with one that prints the size of the generated list of results 
instead (thus forcing all results to be generated):

$ time ./parens 12

[output not reproduced]

real    0m32.514s
user    0m4.470s
sys     0m1.540s

$ time ./parens-noprint 12

"208012"

real    0m1.696s
user    0m1.340s
sys     0m0.060s

Interestingly:

$ time ./parens 12 > /dev/null

real    0m3.921s
user    0m3.280s
sys     0m0.110s


Which implies a larger penalty than I would have thought for the output 
formatting routine which turns a Haskell list into one string per line. 
Perhaps I can come up with something more efficient there.

Sorry if this is clogging up the list, I've not even started on a Perl 
solution yet!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.