[Gloucs] How much faster is assembly language

Bob Wilkinson rwilkinson at messagelabs.com
Mon Sep 19 16:41:54 UTC 2011


On Mon, Sep 19, 2011 at 03:02:09PM +0100, Gerd Busker wrote:
> On 19/09/2011 14:52, Bob Wilkinson wrote:
> >I decided to write some code to find out - and wrote up the results
> >at http://www.fourtheye.org/armstrong.shtml
> 
> Interesting.  Could you show us some results that have a bit more
> calculation time in them?
> Much of this could be due to the difference in startup time of e.g.
> perl and something in assembly.
> 
> Gerd.

I extended the search space out by a further digit so we test
numbers between 10 and 100000 (rather than 10000 as previously) and
see...

bob at poland:~/src/problems_for_computer_solution/07_armstrong_numbers$
time perl armstrong_big.pl
ARMSTRONG NUMBER is 153
ARMSTRONG NUMBER is 370
ARMSTRONG NUMBER is 371
ARMSTRONG NUMBER is 407
ARMSTRONG NUMBER is 1634
ARMSTRONG NUMBER is 8208
ARMSTRONG NUMBER is 9474
ARMSTRONG NUMBER is 54748
ARMSTRONG NUMBER is 92727
ARMSTRONG NUMBER is 93084

real    0m6.192s
user    0m6.170s
sys     0m0.020s
bob at poland:~/src/problems_for_computer_solution/07_armstrong_numbers$
time ./armstrong_big_string
ARMSTRONG NUMBER is 153
ARMSTRONG NUMBER is 370
ARMSTRONG NUMBER is 371
ARMSTRONG NUMBER is 407
ARMSTRONG NUMBER is 1634
ARMSTRONG NUMBER is 8208
ARMSTRONG NUMBER is 9474
ARMSTRONG NUMBER is 54748
ARMSTRONG NUMBER is 92727
ARMSTRONG NUMBER is 93084

real    0m3.303s
user    0m3.300s
sys     0m0.010s
bob at poland:~/src/problems_for_computer_solution/07_armstrong_numbers$
time ./armstrong_big_macro
armstrong number of 153 is 153
armstrong number of 370 is 370
armstrong number of 371 is 371
armstrong number of 407 is 407
armstrong number of 1634 is 1634
armstrong number of 8208 is 8208
armstrong number of 9474 is 9474
armstrong number of 54748 is 54748
armstrong number of 92727 is 92727
armstrong number of 93084 is 93084

real    0m0.044s
user    0m0.050s
sys     0m0.000s
bob at poland:~/src/problems_for_computer_solution/07_armstrong_numbers$ 

Bob

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________



More information about the gloucs mailing list