Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!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.038 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'memory.': 0.05; 'assembler': 0.09; 'to:name:python-list': 0.15; 'subject:Big': 0.16; 'wrote:': 0.17; 'import': 0.21; 'x-mailer:microsoft outlook express 6.00.2900.5931': 0.22; 'url:wiki': 0.26; 'guess': 0.27; 'cpu': 0.29; 'fast.': 0.29; 'url:code': 0.29; 'computer.': 0.32; 'could': 0.32; 'subject:Number': 0.33; 'to:addr:python-list': 0.33; 'there': 0.35; 'but': 0.36; 'charset:us-ascii': 0.36; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'url:p': 0.63; 'skip:n 10': 0.63; 'more': 0.63 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII; format=flowed; reply-type=original From: Gisle Vanem To: Python-list References: <50ebb3c1$0$30003$c3e8da3$5496439d@news.astraweb.com> Subject: Re: Calculate Big Number Date: Tue, 08 Jan 2013 11:06:09 +0100 X-Priority: 3 X-MSMail-priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5931 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 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: , Newsgroups: comp.lang.python Message-ID: Lines: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1357639597 news.xs4all.nl 6947 [2001:888:2000:d::a6]:42418 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:36422 "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. --gv