Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^5: Challenge: Number of unique ways to reach target sum

by fergal (Chaplain)
on Feb 15, 2006 at 15:54 UTC ( [id://530425]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Challenge: Number of unique ways to reach target sum
in thread Challenge: Number of unique ways to reach target sum

Your C takes 72 min on your machine, how long does blokhead's perl version take on the same machine?

Replies are listed 'Best First'.
Re^6: Challenge: Number of unique ways to reach target sum
by Limbic~Region (Chancellor) on Feb 15, 2006 at 18:38 UTC
    fergal,
    I only ran the version that actually iterated (without Memoize) and gave up after about 3 hours.

    Cheers - L~R

      Well, blokhead's memoize version take < 10s so that the easiest thing available as a benchmark and it's takes little effort to run it.

      I managed to generate all solutions just using Perl in 74 mins on one machine and 2 hours on another. I'd like to be able to compare these results to your 72 mins without having to chew 72 mins of CPU. I just tried it on that machine and killed it after 93 mins. It was compiled with -O2. Have you got a very very fast machine? If so then I think Perl with ugly-memoize beats the C, which is very surprising.

        fergal,
        I compiled with the following optimizations:
        gcc -Wall -march=pentium4 -s -funroll-loops -fomit-frame-pointer -O3 l +oops.c -o loops.exe
        When you say that you were able to generate all the solutions in Perl in 74 mins on 1 machine was it using blokhead's code without Memoize or your modification to that code? I ask because then we would be comparing apples and oranges. I had a completely different algorithm.

        Cheers - L~R

        Update: Added second hyphen to -fomit-frame-pointer

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://530425]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2024-03-28 12:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found