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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:30:19+00:00 2026-05-23T08:30:19+00:00

i have a situation, i need to process an jagged array of 20k registers

  • 0

i have a situation, i need to process an jagged array of 20k registers every time a user press a key. I have a grid and while the user is typing the system shows a filtered result in a grid. so. So i have a jagged array filled with all 20k registers. and the i have a list (global to the control) and it´s cleaned up every time the user press a key and filled up with just the filtered registers and then show then in the grid.

Here is the code

the model
public struct PlayerLookUpAdapter
    {
        [Browsable(false)]
        public decimal Id { get; set; }
        [DisplayName("Número")]
        public String Number { get; set; }
        [DisplayName("Nombre")]
        public String Name { get; set; }
        [DisplayName("Apellido")]
        public String Surname { get; set; }
        [DisplayName("DNI")]
        public String Document { get; set; }
        [DisplayName("Estado")]
        public String Status { get; set; }
    }

private PlayerLookUpAdapter[] _source; // here are the 20k registers

List<PlayerLookUpAdapter> filteredOut = new List<PlayerLookUpAdapter>(); // here the filtered ones

// this code is executed every time the user press a key
private void tb_nro_KeyUp(object sender, KeyEventArgs e)
        {
            if (!(e.KeyCode.Equals(Keys.Enter) || e.KeyCode.Equals(Keys.Down)) && _source!=null)
            {
                String text = tb_nro.Text.ToUpper();
                if (String.IsNullOrEmpty(text))
                {
                    fg.DataSource = _source;
                    fg.Refresh();
                    return;
                }
                fg.DataSource = null;
                filteredOut.Clear();
                int length = _source.Length;
                for (int i = 0; i < length; i++)
                {
                    PlayerLookUpAdapter cur = _source[i];
                    if (cur.Number.ToUpper().StartsWith(text) || cur.Surname.ToUpper().StartsWith(text) || cur.Name.ToUpper().StartsWith(text))
                        filteredOut.Add(cur);
                }
                fg.DataSource = filteredOut;
                SetGridColumnsProperties();
                fg.Refresh();

            }
            else
            {
                fg.Focus();
            }
        }

is it a good solution in terms of memory usage and performance? have you got any advice? How can i gain more speed. It works realy good, but what about if i got 100k registers instead of 20k?

Thanks in advance.

  • 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-23T08:30:20+00:00Added an answer on May 23, 2026 at 8:30 am

    I think this should be a prime example for using a tree.

    If you lay your Data down in a Tree (i actually don’t know if C#/.Net supports a Tree Data-Structure, or you have get your own hands dirty).

    The Speed you search in a Tree will increase in comparison for searching in an Array (because a Tree gots a search-speed of somehting like O(n)=n*log(n))

    The Theory is easy: if a User Types in a Literal, the Tree goes to the Node starting with this Literal, on this nodes are all possible other nodes and so on. For example: The User types in an “t” you go to the “t” Node, then he types in an “e” you go to the subnode “te”, there are some other subnodes like “test” and the system will propose the User these subnodes.

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

Sidebar

Related Questions

I have a situation where I need to find the value with the key
I have a situation where I need to provide an efficient way to process
I have a situation where I need to set my process' locale to en-US.
I have situation when I need to communicate with Java process somehow. Java handling
I have a situation where I need to spawn a helper process from within
I have situation where I need to change the order of the columns/adding new
I have a situation where I need to update a control referenced in a
I have a situation where I need to notify some users when something in
I have a situation where i need to send commands to a running java
I have a situation where I need to concatenate several string to form an

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.