Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #52953

Re: Fast conversion of numbers to numerator/denominator pairs

References <521828e7$0$29986$c3e8da3$5496439d@news.astraweb.com> <CAN8CLgm-DPNKXBWbx-jNX+U4OYktqDya-kpeiOGjMNN0ey8tdg@mail.gmail.com>
Date 2013-08-25 08:05 +1000
Subject Re: Fast conversion of numbers to numerator/denominator pairs
From Tim Delaney <timothy.c.delaney@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.203.1377381953.19984.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On 25 August 2013 07:59, Tim Delaney <timothy.c.delaney@gmail.com> wrote:

> Breakdown of the above (for 19 digits):
>
> d.as_tuple() takes about 35% of the time.
>
> The multiply and add takes about 55% of the time.
>
> The exponentiation takes about 10% of the time.
>

Bah - sent before complete.

Since the multiply and add takes such a significant proportion of the time,
compiling the above with Cython should gain you a big win as well. Or find
some other way to turn that loop into native code.

Tim Delaney

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Fast conversion of numbers to numerator/denominator pairs Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-24 03:30 +0000
  Re: Fast conversion of numbers to numerator/denominator pairs Ian Kelly <ian.g.kelly@gmail.com> - 2013-08-24 01:37 -0600
  Re: Fast conversion of numbers to numerator/denominator pairs Ian Kelly <ian.g.kelly@gmail.com> - 2013-08-24 01:50 -0600
  Re: Fast conversion of numbers to numerator/denominator pairs Peter Otten <__peter__@web.de> - 2013-08-24 14:52 +0200
  Re: Fast conversion of numbers to numerator/denominator pairs Tim Delaney <timothy.c.delaney@gmail.com> - 2013-08-25 07:59 +1000
  Re: Fast conversion of numbers to numerator/denominator pairs Tim Delaney <timothy.c.delaney@gmail.com> - 2013-08-25 08:05 +1000

csiph-web