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


Groups > comp.lang.python > #4105

Re: Terrible FPU performance

References <BANLkTinvFDug8u=JQKiG2uxLMQN8h9LDJw@mail.gmail.com>
Date 2011-04-27 15:11 +1000
Subject Re: Terrible FPU performance
From Alec Taylor <alec.taylor6@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.884.1303881103.9059.python-list@python.org> (permalink)

Show all headers | View raw


What's an FPU?

On Tue, Apr 26, 2011 at 11:40 PM, Mihai Badoiu <mbadoiu@gmail.com> wrote:
> Hi,
> I have terrible performance for multiplication when one number gets very
> close to zero.  I'm using cython by writing the following code:
>     cdef int i
>     cdef double x = 1.0
>     for 0 <= i < 10000000:
>         x *= 0.8
>         #x += 0.01
>     print x
> This code runs much much slower (20+ times slower) with the line x += 0.01
> uncommented.  I looked at the deassembled code and it looks correct.
>  Moreover, it's just a few lines and by writing a C code (without python on
> top), I get the same code, but it's much faster.  I've also tried using sse,
> but I get exactly the same behavior.  The best candidate that I see so far
> is that Python sets up the FPU in a different state than C.
> Any advice on how to solve this performance problem?
> thanks!
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>

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


Thread

Re: Terrible FPU performance Alec Taylor <alec.taylor6@gmail.com> - 2011-04-27 15:11 +1000
  Re: Terrible FPU performance rusi <rustompmody@gmail.com> - 2011-04-26 22:34 -0700
  Re: Terrible FPU performance Ben Finney <ben+python@benfinney.id.au> - 2011-04-27 16:28 +1000

csiph-web