
Dear list! I noticed that `round` seem to run very slow. Is this a known issue or should I file an bug report? Or am I missing something? from timeit import timeit print timeit('int(sqrt(123.456)+0.5)', 'from math import sqrt') print timeit('int(round(sqrt(123.456)))', 'from math import sqrt') prints: 0.00339508056641 1.18832707405 Thanks!

Hi Tuom, On 26 May 2017 at 19:04, Tuom Larsen <tuom.larsen@gmail.com> wrote:
I noticed that `round` seem to run very slow. Is this a known issue or should I file an bug report? Or am I missing something?
You're perfectly right. Yes, please open a bug report. It looks like an easy fix: "def round_double()" in rpython/rlib/rfloat.py is a copy of CPython's version, but without the fast path for the case of "round(x, 0)", which is the default. A bientôt, Armin.

Created at https://bitbucket.org/pypy/pypy/issues/2563/slow-round Thank you for the explanation! On Fri, May 26, 2017 at 10:34 PM, Armin Rigo <armin.rigo@gmail.com> wrote:

Hi Tuom, On 26 May 2017 at 19:04, Tuom Larsen <tuom.larsen@gmail.com> wrote:
I noticed that `round` seem to run very slow. Is this a known issue or should I file an bug report? Or am I missing something?
You're perfectly right. Yes, please open a bug report. It looks like an easy fix: "def round_double()" in rpython/rlib/rfloat.py is a copy of CPython's version, but without the fast path for the case of "round(x, 0)", which is the default. A bientôt, Armin.

Created at https://bitbucket.org/pypy/pypy/issues/2563/slow-round Thank you for the explanation! On Fri, May 26, 2017 at 10:34 PM, Armin Rigo <armin.rigo@gmail.com> wrote:
participants (2)
-
Armin Rigo
-
Tuom Larsen