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 8561277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:28:02+00:00 2026-06-11T16:28:02+00:00

I did see this post but it does not answer my question: C/Python Socket

  • 0

I did see this post but it does not answer my question: C/Python Socket Performance?

I have been tasked with creating an application that can create thousands of connections based on sockets. I can do this in Python but I want to have room for performance improvements. I know it’s possible in Python because of my past projects, but I’m curious how much of a performance improvement this would be if I was to do this project in C (not 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-06-11T16:28:03+00:00Added an answer on June 11, 2026 at 4:28 pm

    It really depends on what you’re doing with the sockets.

    The best generic answer is: Usually Python is good enough that it doesn’t matter, but sometimes it’s not.

    The overhead in the time taken to create and connect sockets is minimal, and reading and writing isn’t much worse. But that doesn’t matter, that’s pretty much never any significant time spent doing that anyway.

    There are reactors and proactors for Python every bit as good as the general-purpose ones available for C (and half of the C libraries have Python bindings). If you’re not doing much significant work beyond the sockets, this is often your main bottleneck. If you’ve got a very specific use pattern and/or very tightly specified hardware, you might be able to write a custom reactor or proactor that beats out anything general-purpose. In that case, you pretty much have to go with C, not Python.

    But usually, you’ve got significant work to do beyond just manipulating sockets.

    If that work is mostly independent and highly parallelizable, C obviously beats Python (because of the GIL), unless the jobs are heavy enough that you can multi-process them (and keep in mind that “heavy enough” can be pretty heavy on Windows platforms). Except, of course, that it’s incredibly easy to screw up performance (not to mention stability) writing multi-threaded C code; really, something like Erlang or Haskell is probably a better bet here than either C or Python. (If you’re about to say, “But we’ve got people who are experienced at C but they can’t learn Haskell”, then those people are probably not good enough programmers to write multi-threaded code.)

    If that work is mostly memory copying between socket buffers, and you can deal with a tightly-specified system, you may be able to write C code that optimizes zero-copies, and there’s no way to do that in Python.

    But if it’s mostly typical things like waiting on disk or serialized computation, then it scarcely matters how you write the socket-stuff, because it’s going to end up waiting on the real code anyway.

    So, without any more information, I’d go with Python, because the time you save getting things up and running and debugged vs. C can be spent optimizing or otherwise improving whatever turns out to matter.

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

Sidebar

Related Questions

Looking for a proven to work algorithm for production. Did see this example but
This post derives from my question extending cell definition to cellframelabels . I've been
First let me say that I did see this article: How to remove AspxAutoDetectCookieSupport
Earlier I had a problem when an inner anonymous class did not see a
Did you ever have the following situation: you need to store information, but a
Did I not get enough sleep or what? This following code var frame=document.getElementById(viewer); frame.width=100;
Did not have luck with these examples: Javascript File remove Javascript FSO DeleteFile Method
I hate to post this but I am seeing unwanted animation in an iPhone
I did not find a post which ask for the same restriction as me.
If this has been asked before, I apologize but this is kinda of a

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.