Hi,
I don't know if this really a bug, but trying to do some benchmarks with a factorial between Smallalk dialects, I got a code dumped: st> Integer extend [ st> factorial [ st> self = 0 ifTrue: [^1]. st> self > 0 ifTrue: [^self * (self -1) factorial]]] st> 100 factorial 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000 st> Time millisecondsToRun: [10000 factorial] "Global garbage collection... done, heap grown" "Global garbage collection... done, heap grown" "Global garbage collection... done, heap grown" "Global garbage collection... done, heap grown" "Global garbage collection... done, heap grown" "Global garbage collection... done" "Global garbage collection... done, heap grown" "Global garbage collection... done, heap grown" "Global garbage collection... done" "Global garbage collection... done, heap grown" "Global garbage collection... done, heap grown" 26602 st> 10000 factorial "Global garbage collection... done, heap grown" "Global garbage collection... done, heap grown" "Global garbage collection... done, heap grown" "Global garbage collection... done" "Global garbage collection... done, heap grown" "Global garbage collection... done, heap grown" "Global garbage collection... done, heap grown" "Global garbage collection... done, heap grown" "Global garbage collection... done, heap grown" stdin:28: Aborted (ip 58)LargePositiveInteger>>#divide:using: (ip 76)LargePositiveInteger(LargeInteger)>>#// (ip 28)LargePositiveInteger(Number)>>#retry:coercing: (ip 40)LargePositiveInteger(LargeInteger)>>#// (ip 104)LargePositiveInteger(Integer)>>#floorLog: (ip 44)LargePositiveInteger(Integer)>>#printString: (ip 6)LargePositiveInteger(Integer)>>#printString (ip 6)LargePositiveInteger(Object)>>#printNl (ip 0)<bottom> Abandon (core dumped) It looks like the printNl made it crash, which may be normal, I don't know, that's why I'm asking. BTW, in Squeak it takes 397 ms on my computer to run 10000 factorial while it takes more than 26 seconds with gst. Nico _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk signature.asc (204 bytes) Download Attachment |
> It looks like the printNl made it crash, which may be normal, I don't > know, that's why I'm asking. Yes, the example is biased because printing 10000 factorial is much heavier than computing it. You should compare "10000 factorial" with a print-it on Squeak. To compare with doits, use something like "10000 factorial; yourself" or "10000 factorial size". > BTW, in Squeak it takes 397 ms on my computer to run 10000 factorial > while it takes more than 26 seconds with gst. Hum, it crashes almost instantly here, even with #millisecondsToRun:. Paolo _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
In reply to this post by Nicolas Petton
Le vendredi 21 novembre 2008 à 17:36 +0100, Paolo Bonzini a écrit :
> > It looks like the printNl made it crash, which may be normal, I don't > > know, that's why I'm asking. > > Yes, the example is biased because printing 10000 factorial is much > heavier than computing it. You should compare "10000 factorial" with a > print-it on Squeak. To compare with doits, use something like "10000 > factorial; yourself" or "10000 factorial size". I did it, and results are not really better: it still takes 6 seconds to compute 5000 factorial and 21 seconds to compute 10000 factorial, while with Squeak it only takes 100 milliseconds and 420 milliseconds, and I got similar results with VisualWorks. > > > BTW, in Squeak it takes 397 ms on my computer to run 10000 factorial > > while it takes more than 26 seconds with gst. > > Hum, it crashes almost instantly here, even with #millisecondsToRun:. Yes, it does sometimes here too, but not always... Nico _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk signature.asc (204 bytes) Download Attachment |
In reply to this post by Paolo Bonzini-2
> I did it, and results are not really better: it still takes 6 seconds to > compute 5000 factorial and 21 seconds to compute 10000 factorial, while > with Squeak it only takes 100 milliseconds and 420 milliseconds, and I > got similar results with VisualWorks. Aha, I think I know. You don't have GMP installed (check for /usr/include/gmp.h or /sw/include/gmp.h). You're running on pure Smalltalk LargeIntegers. Doesn't look too bad now, does it (except for the crashes)? :-P Paolo _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
In reply to this post by Nicolas Petton
> Aha, I think I know. You don't have GMP installed (check for
> /usr/include/gmp.h or /sw/include/gmp.h). You're running on pure > Smalltalk LargeIntegers. Doesn't look too bad now, does it (except for > the crashes)? :-P Excellent, you are right ;) Let me try again with GMP. Nico _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk signature.asc (204 bytes) Download Attachment |
> Let me try again with GMP. Atfer installing GMP and recompiling smalltalk, I have *better* results: (10 executions on each dialect) Time millisecondsToRun: [1000 factorial] - Squeak: 9 - VisualWorks: 6 - GNU Smalltalk: 6 Time millisecondsToRun: [10000 factorial] - Squeak: between 370 and 440 - VisualWorks: between 319 and 369 - GNU Smalltalk: between 320 and 432 Nico _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk signature.asc (204 bytes) Download Attachment |
Free forum by Nabble | Edit this page |