Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7695759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:37:07+00:00 2026-05-31T21:37:07+00:00

Does pypy handle threads and sockets quickly compared to hand written C? Compared to

  • 0

Does pypy handle threads and sockets quickly compared to hand written C? Compared to normal python?

I would just try it, but the python code in question was written for a small cluster of computers on which I am not an admin. I’m asking here because my attempts to google only provided comparisons to cython, unladen swallow, ect., and I don’t want to bug the admin about it if this is unlikely to work.

I don’t actually need pypy to be as good at C; I’m looking to use it because right now the interpreter’s overhead is completely overshadowing the computation I’m trying to time. I just need pypy to get me in the neighborhood of handwritten C.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T21:37:08+00:00Added an answer on May 31, 2026 at 9:37 pm

    Does pypy handle threads and sockets quickly compared to hand written C?

    No. It’s usually the same or worse.

    PyPy retains the Global Interpreter Lock (GIL) that CPython has. This means native threads cannot run Python code in parallel. Python threads also have additional semantics that come at a cost. Much synchronization surrounds Python thread start-up, shutdown, and tracking of the thread objects. By comparison, C threads will start up faster, are cheaper to use, and can run completely in parallel.

    Efficient socket handling requires minimizing time not spent waiting for the next socket event. Since PyPy’s threading model is still bound by the GIL, this means threads that return from blocking socket calls can’t proceed until they acquire the GIL. Equivalent C code generally executes faster, and can return to waiting on socket events sooner.

    Compared to normal python?

    Yes. But not much.

    For the reasons above, PyPy will, except for occasional spikes due to JIT and and other overheads, require less CPU time for the equivalent code. Therefore both thread and socket handling is faster and more responsive.

    I would just try it, but the python code in question was written for a small cluster of computers on which I am not an admin. I’m asking here because my attempts to google only provided comparisons to cython, unladen swallow, ect., and I don’t want to bug the admin about it if this is unlikely to work.

    PyPy will only make noticeable performance improvements if your code is CPU bound. PyPy is the fastest Python implementation I know of that runs natively. You could investigate some of the other implementations, or consider writing C extensions if true threading parallelism is a high priority for you.

    I don’t actually need pypy to be as good at C; I’m looking to use it because right now the interpreter’s overhead is completely overshadowing the computation I’m trying to time. I just need pypy to get me in the neighborhood of handwritten C.

    Closing the performance gap with C is currently PyPy’s single greatest feature. I highly recommend you try it out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know how to add an item to a list but do it
Does map() iterate through the list like for would? Is there a value in
Does anyone know of an equivalent to FxCop/StyleCop for Delphi? I would really like
Does anyone know of a Mootools script that provides nested sortable but also works
Does doxygen doesn't work properly on python script with a shebang? I tried one
I was looking up the pypy project (Python in Python), and started pondering the
I'm currently writing a Python sandbox using sandboxed PyPy. Basically, the sandbox works by
Does PyPy work with NLTK, and if so, is there an appreciable performance improvement,
I must use goto in Python. I found entrians goto but my Python implementation
Am I getting this straight? Does the PyPy interpreter actually interpret itself and then

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.