Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benchmark with HPy 0.0.3 and PyPy3 7.3.6 #6

Open
wants to merge 8 commits into
base: hpy
Choose a base branch
from
Open

Conversation

paugier
Copy link

@paugier paugier commented Oct 12, 2021

No description provided.

@paugier paugier force-pushed the bench-hpy0.0.3 branch 2 times, most recently from 1929d8b to ba809f3 Compare October 12, 2021 10:20
@paugier paugier force-pushed the bench-hpy0.0.3 branch 3 times, most recently from 0e495a0 to 9e5aae7 Compare October 12, 2021 12:16
@mattip
Copy link

mattip commented Oct 12, 2021

Tests are failing with

>       assert (a + 2 * a).tolist() == [3.0, 6.0]
E       TypeError: unsupported operand type(s) for *: 'int' and 'array'

Is someting missing in PyPy?

@mattip
Copy link

mattip commented Oct 12, 2021

It seems that PyPy and CPython, using the HPy universal mode, have the same timing. Do you know the proportion of the time the benchmark spends inside C code vs. interpreter?

@paugier
Copy link
Author

paugier commented Oct 12, 2021

Tests are failing with

>       assert (a + 2 * a).tolist() == [3.0, 6.0]
E       TypeError: unsupported operand type(s) for *: 'int' and 'array'

Is someting missing in PyPy?

I guess reversed slots are not fully supported. See https://foss.heptapod.net/pypy/pypy/-/issues/3509.

@paugier
Copy link
Author

paugier commented Oct 12, 2021

It seems that PyPy and CPython, using the HPy universal mode, have the same timing. Do you know the proportion of the time the benchmark spends inside C code vs. interpreter?

I checked and a large part of the time (~70%) is spent in the function board (https://github.com/hpyproject/piconumpy/blob/hpy/bench/bench_cpy_vs_hpy.py#L32), i.e. getting 4 floats from a piconumpy array, simple computations with floats and creating a new piconumpy array.

See also this issue on the performance with pure Python code for the same code: https://foss.heptapod.net/pypy/pypy/-/issues/3513

@paugier paugier changed the title WIP: Benchmark with HPy 0.0.3 and PyPy3 7.3.6 Benchmark with HPy 0.0.3 and PyPy3 7.3.6 Oct 12, 2021
@paugier
Copy link
Author

paugier commented Oct 12, 2021

Github Actions give:

 {'cache_tag': 'pypy37',
 'version': sys.pypy_version_info(major=7, minor=3, micro=7, releaselevel='alpha', serial=0)}
Julia:           0.030 seconds
CPython C-API:   1.106 seconds (36.6 * Julia)
HPy [Universal]: 0.276 seconds ( 9.1 * Julia)
Python list:     0.163 seconds ( 5.4 * Julia)

and

{'cache_tag': 'cpython-37',
 'version': sys.version_info(major=3, minor=7, micro=12, releaselevel='final', serial=0)}
Julia:           0.026 seconds
CPython C-API:   0.226 seconds ( 8.7 * Julia)
HPy [Universal]: 0.263 seconds (10.2 * Julia)
HPy [CPy ABI]:   0.248 seconds ( 9.6 * Julia)

For CPython, the CPython C-API version still seems a bit faster than the HPy [CPy ABI] version. This might be because of the C codes doing slightly different things.

For HPy [Universal], it is still a bit faster for CPython than for PyPy (warning: the results for Julia are a bit different for the 2 jobs). It's consistent with what I get on my computer.

It's already much better than with the CPython API but it is a bit frustrating and not very nice to advertise HPy.

@paugier
Copy link
Author

paugier commented Nov 27, 2021

Could we merge this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants