Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Improve SSL performance by calling SSLProtocol methods directly, not through the python's vectorcall interface #626

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

Open
tarasko wants to merge 7 commits into MagicStack:master
base: master
Choose a base branch
Loading
from tarasko:ssl_optimizations

Conversation

@tarasko
Copy link

@tarasko tarasko commented Sep 7, 2024
edited
Loading

After profiling my app with perf I identified a couple of things that make SSLProtocol a little bit faster:

  • SSLProtocol.get_buffer and buffer_updated can be called directly from UVStream since it is our own type and we know it's definition
  • Added inline directive to all private methods of SSLProtocol to avoid vtable calls

Before:

--42.75%--__pyx_f_6uvloop_4loop___uv_stream_buffered_on_read
 | 
 --42.19%--__pyx_f_6uvloop_4loop_run_in_context1
 | 
 --41.92%--cfunction_vectorcall_FASTCALL_KEYWORDS
 context_run
 | 
 --41.83%--_PyObject_VectorcallTstate.lto_priv.18
 | 
 --41.73%--method_vectorcall
 | 
 --41.32%--__pyx_pw_6uvloop_4loop_11SSLProtocol_15buffer_updated
--2.51%--__pyx_f_6uvloop_4loop___uv_stream_buffered_alloc
 | 
 --1.40%--__pyx_f_6uvloop_4loop_run_in_context1
 | 
 --0.67%--cfunction_vectorcall_FASTCALL_KEYWORDS
 context_run

After:

--43.18%--__pyx_f_6uvloop_4loop___uv_stream_buffered_on_read
 | 
 --42.57%--__pyx_f_6uvloop_4loop_11SSLProtocol_buffer_updated_impl
--0.79%--__pyx_f_6uvloop_4loop___uv_stream_buffered_alloc
 | 
 --0.60%--PyGILState_Ensure

@tarasko tarasko changed the title (削除) Optimizations for SSLProtocol (削除ここまで) (追記) Optimize SSL performance by calling SSLProtocol methods directly, not through the python's vectorcall interface (追記ここまで) Oct 15, 2024
@tarasko tarasko changed the title (削除) Optimize SSL performance by calling SSLProtocol methods directly, not through the python's vectorcall interface (削除ここまで) (追記) Improve SSL performance by calling SSLProtocol methods directly, not through the python's vectorcall interface (追記ここまで) Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /