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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:49:05+00:00 2026-06-04T14:49:05+00:00

I have a list from 10,000 long value and I want to compare that

  • 0

I have a list from 10,000 long value
and I want to compare that data withe 100,000 other long value
compare is a bitwise operation –>

if (a&b==a) count++;

which algoritm I can use for getting best performance?

  • 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-04T14:49:06+00:00Added an answer on June 4, 2026 at 2:49 pm

    If I understand your question correctly, you want to check a against each b whether some predicate is true. So a naive solution to your problem would be as follows:

    var result = aList.Sum(a => bList.Count(b => (a & b) == a));
    

    I’m not sure this can really be sped up for an arbitrary predicate, because you can’t get around checking each a against each b. What you could try is run the query in parallel:

    var result = aList.AsParallel().Sum(a => bList.Count(b => (a & b) == a));
    

    Example:

    aList: 10,000 random long values; bList: 100,000 random long values.

    • without AsParallel: 00:00:13.3945187

    • with AsParallel: 00:00:03.8190386

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

Sidebar

Related Questions

I have to read 100.000 rows from database, I use this code : List<elementClass>
I have a List<List> . I want to get a single List from that.
I have a list of URLs from which I want to scrape an attribute.
Let's say that I have a list of data: {1, 2, 3, 4, 5,
I have a list of 8000 strings (stop_words) and a list of 100,000 strings
I have a list of 100,000 objects. Every list element has a weight associated
I have 2 sets of data from different systems. About 20,000 records a piece.
I have list of maybe 50,000 entries that are populated in datagrid in wpf.
I have a list of objects (created from several text files) in C#.net that
I have a dynamic ul list from a database being outputted as categories however

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.