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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:12:22+00:00 2026-06-18T00:12:22+00:00

I have 200k lists stored in a MySQL database. Given a list A, I

  • 0

I have 200k lists stored in a MySQL database. Given a list A, I need to calculate a similarity score between A and each list X of the 200k lists. Assume the similarity metric is something simple such as the length of the set intersection of A and X.

Given the nature of pairwise comparison, I couldn’t think of a way to improve on O(N) for this, so improving the runtime means working with multiple CPU cores. Right now I have this task split across 4 cores using multithreading.Pool(), but it still takes nearly 10 minutes to complete. Worse, my computer shuts down to protect itself.

For anyone who’s dealt with this before, do you have an alternative method that you can share?

  • 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-18T00:12:23+00:00Added an answer on June 18, 2026 at 12:12 am
    def bestmatch(A, lists):
         a = set(A)
         return min(lists, key=lambda x:  len(set(x) & a)
    

    Using min does the looping a C speed. The lambda is a closure that references a quickly. The set(A) step is computed only once, rather than in the inner-loop.

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

Sidebar

Related Questions

I have a table in my MySQL database containing 200K records. Each record contains
I have a sql statement where I'm joining about 4 tables, each with 200K
Here is my problem. I have a dataset with 200k rows. Each row corresponds
I have a big data set (around 200k rows) where each row is a
I need a list of booleans (size anywhere from 200 to 200k). If i
I have a folder that contains more than 200K images. Some images will follow
I have a huge file (with around 200k inputs). The inputs are in the
I need to develop an app that is using multithreading. Basicly, I have a
I am desiging a new table that will potentially have 200K rows. I would
I have 200,000 strings. I need to find the similar strings among that set.

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.