Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eweka.nl!lightspeed.eweka.nl!194.134.4.91.MISMATCH!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.020 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'memory.': 0.05; 'python': 0.09; 'assembler': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'digits.': 0.16; 'subject:Big': 0.16; 'varies': 0.16; 'wrote:': 0.17; 'import': 0.21; 'occurs': 0.22; 'cc:2**0': 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'url:wiki': 0.26; 'guess': 0.27; 'cpu': 0.29; 'fast.': 0.29; 'url:code': 0.29; 'usually': 0.30; 'computer.': 0.32; 'could': 0.32; 'platform,': 0.33; 'subject:Number': 0.33; 'received:google.com': 0.34; 'faster': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'from:no real name:2**0': 0.60; 'between': 0.63; 'url:p': 0.63; 'skip:n 10': 0.63; 'more': 0.63; '100': 0.78; '2013': 0.84 Newsgroups: comp.lang.python Date: Tue, 8 Jan 2013 08:33:03 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=192.94.38.34; posting-account=0vXMwQoAAADCTO6LSb66apqOI0WiEK9C References: <50ebb3c1$0$30003$c3e8da3$5496439d@news.astraweb.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 192.94.38.34 MIME-Version: 1.0 Subject: Re: Calculate Big Number From: casevh@gmail.com To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Cc: Python-list X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1357662793 news.xs4all.nl 6841 [2001:888:2000:d::a6]:58314 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:36440 On Tuesday, January 8, 2013 2:06:09 AM UTC-8, Gisle Vanem wrote: > "Steven D'Aprano" wrote: > > > py> from timeit import Timer > > py> t1 = Timer("(a**b)*(c**d)", setup="a,b,c,d = 10, 25, 2, 50") > > py> min(t1.repeat(repeat=5, number=100000)) > > 0.5256571769714355 > > > > So that's about 5 microseconds on my (slow) computer. > > That's pretty fast. So is there still a need for a GMP python-binding like > gmpy? http://code.google.com/p/gmpy/wiki/IntroductionToGmpy > > GMP can include optimized assembler for the CPU you're using. But > I guess it needs more memory. Hence disk-swapping could be an issue > on performance. > gmpy will be faster than Python as the numbers get larger. The cutover varies depending on the platform, but usually occurs between 50 and 100 digits. casevh > > --gv