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

  • SEARCH
  • Home
  • 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 8238107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:41:51+00:00 2026-06-07T19:41:51+00:00

I have written a code to take an input from a file of very

  • 0

I have written a code to take an input from a file of very big data, perform some simple processing on it and then store it in a shelve dictionary format. I have 41 million entries to process. However, after I write 35 million entries to the shelve dict, performance suddenly drops and eventually completely halts. Any idea what I can do to avoid this?

My data is on twitter and it maps user screen names to their ID’s. Like so:

Jack 12
Mary 13
Bob 15

I need to access each of these by name very quickly. Like: when I give my_dict[Jack] it returns 12.

  • 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-07T19:41:53+00:00Added an answer on June 7, 2026 at 7:41 pm

    Consider using something more low-level. Shelve performance can be quite low, unfortunately. This doesn’t explain the slow-down you are seeing though.

    For many disk-based indexes it helps if you can initialize them with an expected size, so they do not need to reorganize themselves on the fly. I’ve seen this with a huge performance impact for on-disk hash-tables in various libraries.

    As for your actual goal, have a look at:

    http://docs.python.org/library/persistence.html

    in particular the gdbm, dbhash, bsddb, dumbdbm and sqlite3 modules.

    sqlite3 is probably not the fastest, but the easiest to use one. After all, it has a command line SQL client. bsddb probably is faster, in particular if you tune nelem and similar parameters for you data size. And it does have a lot of language bindings, too; likely even more than sqlite.

    Try to create your database with an initial size of 41 million, so it can optimize for this size!

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

Sidebar

Related Questions

I have written the following code to perform some simultaneous HTTP posting and file
I have written code to perform a function that could take a while to
I have written a code for taking JSON data from a PHP and putting
I have written a code where in it would take in a executable file
I have some code written by someone else in which some functions take arguments
I have written a PHP function to take a video embed code that has
I have written this code inside a servlet to delete certain records from three
I have written some code that loads an XML document using an XmlDocument object
I have written some code for displaying a drop down list, but the code
I have written two methods that take and return a string. One converts from

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.