Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
pypy
pypy
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 594
    • Issues 594
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 10
    • Merge Requests 10
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

This instance will be upgraded to the latest Heptapod 0.20rc on 2021-02-26 at 11:00 UTC+1

  • PyPy
  • pypypypy
  • Issues
  • #3142

Closed
Open
Opened Jan 05, 2020 by Bitbucket Importer@bitbucket_importerMaintainer

Performance with simple numpy arrays

Created originally on Bitbucket by paugier (Pierre Augier)

I’m having a look at how much Python is bad with callbacks of tiny functions (https://github.com/paugier/bench_integrate_callback). I was motivated by a benchmark from Julia people showing than Julia is much faster than Scipy for ODEs integration with tiny callback functions (https://github.com/JuliaDiffEq/SciPyDiffEq.jl).

I thought that PyPy could be good to accelerate scipy.integrate.solve_ivp since the code of solve_ivp (https://github.com/scipy/scipy/tree/master/scipy/integrate/_ivp) is mostly “simple” Python using “simple” Numpy. However, it’s much slower with PyPy.

I isolated a very simple case with a callback to check what happens.

With a pure Python version (https://github.com/paugier/bench_integrate_callback/blob/master/purepython_callback.py), PyPy is 30 times faster than CPython! However, with a versions for which the time values are stored in a Numpy array (https://github.com/paugier/bench_integrate_callback/blob/master/numpy_callback.py), PyPy is 54 times slower than for the version for which the time values are stored in a list (therefore nearly 2 times slower than CPython).

The only difference between the 2 scripts is times = dt * np.arange(1e5) instead of times = [dt * it for it in range(int(1e5))]. Of course, most of the elapsed time is not spent in this line but in the loop.

It’s sad that PyPy can’t accelerate Python code using simple Numpy. I realized that it is not something new, but still I’d like to ask if there is any chance that PyPy could be improved in that respect.

‌

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: pypy/pypy#3142