Python 3.3 vs. MSDOS Basic

Piet van Oostrum piet at vanoostrum.org
Tue Feb 19 12:42:15 CET 2013


Terry Reedy <tjreedy at udel.edu> writes:

> On 2/18/2013 2:13 PM, John Immarino wrote:
>> I coded a Python solution for Problem #14 on the Project Euler
>> website. I was very surprised to find that it took 107 sec. to run
>> even though it's a pretty simple program.  I also coded an equivalent
>> solution for the problem in the old MSDOS basic. (That's the 16 bit
>> app of 1980s vintage.)  It ran in 56 sec. Is there a flaw in my
>> coding, or is Python really this slow in this particular application.
>> MSDOS Basic usually runs at a snails pace compared to Python.
>
> I find this surprising too. I am also surprised that it even works,
> given that the highest intermediate value is about 57 billion and I do
> not remember that Basic had infinite precision ints.

That may explain why the Basic version is faster: it gets overflow and
then it may have taken some shortcuts.
-- 
Piet van Oostrum <piet at vanoostrum.org>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]



More information about the Python-list mailing list