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

Compile the monitor greenlet tracer with Cython #1190

Merged
merged 3 commits into from Apr 23, 2018

Conversation

Projects
None yet
1 participant
@jamadden
Member

jamadden commented Apr 23, 2018

This makes things 54% faster. In fact, the monitor tracer is now faster than a trivial tracer implemented in python (settrace(lambda e, a: None)).

no tracer: Mean +- std dev: 414 ns +- 10 ns
trivial tracer: Mean +- std dev: 792 ns +- 16 ns

Benchmark 37_bench_tracer 37_bench_tracer_cython_opt3
monitor tracer 1.62 us 739 ns: 2.20x faster (-54%)
max switch tracer 3.06 us 874 ns: 3.50x faster (-71%)
hub switch tracer 2.16 us 815 ns: 2.66x faster (-62%)

jamadden added some commits Apr 23, 2018

Add benchmark for greenlet tracers. [skip ci]
Current numbers on 3.7b3:

no tracer: Mean +- std dev: 414 ns +- 10 ns
trivial tracer: Mean +- std dev: 792 ns +- 16 ns
monitor tracer: Mean +- std dev: 1.62 us +- 0.12 us
max switch tracer: Mean +- std dev: 3.06 us +- 0.12 us
hub switch tracer: Mean +- std dev: 2.16 us +- 0.04 us
Move the greenlet tracers to their own file and compile with cython.
Unoptimized still makes them 25% faster:

+-------------------+-----------------+------------------------------+
| Benchmark         | 37_bench_tracer | 37_bench_tracer_first_cython |
+===================+=================+==============================+
| trivial tracer    | 792 ns          | 786 ns: 1.01x faster (-1%)   |
+-------------------+-----------------+------------------------------+
| monitor tracer    | 1.62 us         | 1.24 us: 1.31x faster (-24%) |
+-------------------+-----------------+------------------------------+
| max switch tracer | 3.06 us         | 1.89 us: 1.62x faster (-38%) |
+-------------------+-----------------+------------------------------+
| hub switch tracer | 2.16 us         | 1.68 us: 1.29x faster (-22%) |
+-------------------+-----------------+------------------------------+
Compile the monitor greenlet tracer with Cython.
This makes things 54% faster. In fact, the monitor tracer is now faster than a trivial tracer implemented in python (settrace(lambda e, a: None)).

+-------------------+-----------------+-----------------------------+
| Benchmark         | 37_bench_tracer | 37_bench_tracer_cython_opt3 |
+===================+=================+=============================+
| monitor tracer    | 1.62 us         | 739 ns: 2.20x faster (-54%) |
+-------------------+-----------------+-----------------------------+
| max switch tracer | 3.06 us         | 874 ns: 3.50x faster (-71%) |
+-------------------+-----------------+-----------------------------+
| hub switch tracer | 2.16 us         | 815 ns: 2.66x faster (-62%) |
+-------------------+-----------------+-----------------------------+

Not significant (2): no tracer; trivial tracer

@jamadden jamadden merged commit ab5272c into master Apr 23, 2018

4 of 5 checks passed

continuous-integration/appveyor/branch AppVeyor build failed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
coverage/coveralls First build on master at 84.873%
Details

@jamadden jamadden deleted the cython-tracer branch Apr 23, 2018

jamadden added a commit that referenced this pull request May 3, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment