Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!nuzba.szn.dk!pnx.dk!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Piet van Oostrum Newsgroups: comp.lang.python Subject: Re: Python 3.3 vs. MSDOS Basic Date: Tue, 19 Feb 2013 12:42:15 +0100 Lines: 21 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: individual.net SXfb2o6VCiYHp343VxYblw6p+DVc1YrRqxy+SDJEhVKN2z5RxpqjOjYa5ks7Ivukqt Cancel-Lock: sha1:u3OmhFHuJM9ZaHBUQJuFRu1EKjY= sha1:BpjH+v8rqolMB/J3AfmCb0QdYnQ= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3.50 (darwin) Xref: csiph.com comp.lang.python:39208 Terry Reedy 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 WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4]