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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:10:00+00:00 2026-05-15T17:10:00+00:00

On a quest to learn a bit about Python and sockets I’m writing a

  • 0

On a quest to learn a bit about Python and sockets I’m writing a little 2d-game server.

And although I don’t see more than a few people on this server at any given time, I want to write it as efficiently as I can.

I have a global dictionary called “globuser”, in it is another dictionary containing the user stats (like the X & Y coordinates)

Is that the best way to store them? How big can a dictionary get?
I guess you could also try to use a regular database, but that would be insanely slow.
Or should I use an entirely different scheme?

Can multiple threads access the same variable at the same time, or are they put on hold?
I guess when lots of users are on-line, every move would require an update. If they can happen at the same time, great! But if they each require to “lock” the variable, that would be less great.

  • 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-15T17:10:00+00:00Added an answer on May 15, 2026 at 5:10 pm

    One thing I might look at is storing the users as a list of Player objects. Look into __slots__, as that will save you memory when creating many instances.

    I also would not worry much about performance at this stage. Write the code first and then run it through a profiler to find out where it is slowest — making blind changes in the name of optimization is bad juju.

    Regarding thread safety and sharing of data, I found this, which seems to give some info on the subject.

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

Sidebar

Related Questions

In my quest in trying to learn more about OOP in PHP. I have
In my quest to learn javascript (which seems to be my latest source of
On my quest to learn NHibernate I have reached the next hurdle; how should
In my latest quest to learn some assembly language I'm finding myself constantly going
In my quest to learn C++, I have come across dynamic and static libraries.
I'm on a personal quest to learn how the rsync algorithm works. After some
I've written a Binary Tree program that asks the user questions to learn about
I'm on a quest to see if I can figure out how to access
On a quest to migrate some new UI into Managed/C# land, I have recently
In the quest for localization I need to find all the string literals littered

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.