8000 `round` implementaion is tremendously slow · Issue #330 · PythonCharmers/python-future · GitHub
[go: up one dir, main page]

Skip to content
round implementaion is tremendously slow #330
Open
@germn

Description

@germn

Code to reproduce the problem:

import timeit


# Default implementation:
# 0.0279839634584
print(
    timeit.timeit(
        '[round(0.5 * n) for n in range(100)]', 
        number=1000
    )
)


# python-future's implementation:
# 2.35042388427
print(
    timeit.timeit(
        '[round(0.5 * n) for n in range(100)]', 
        setup="from builtins import round",
        number=1000
    )
)

100 times performance reduction comparing to default implementation is a serious thing.
It should be at least documented.

Tested with:
Python 2.7.13 x64
future 0.16.0
Windows 10 x64

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0