Poor performance with adding List to Dropdown

Hi!

I am having an issue with extremely poor performance when making a list of child components that are displayed in TMP Dropdown. The list is huge (+5000 children) but even with 500 it is not much better.

I have a seen an architectural mobile app that did just the same with even a greater list of child objects so I am certain it is my poor technical execution and not a technical limitation of Unity. I don’t need to form a list of anything else but the name of the child.

Here’s the execution:

List names = new List() {"test"};

public TMP_Dropdown dropdown;
public GameObject ImportedModel;

private string rename;
void Start()
{
    var list0 = ImportedModel.GetComponentsInChildren(typeof(Component));
    for (int i0 = 3; i0 < list0.Length; i0++)
    {
        rename = list0[i0].name;
        names.Add(rename.ToString());
}

I would appreciate tips on how to optimize performance to make this work, for example whether I should use something other than a List. The child objects also exist in an XLM. document so they could be read from a file and not inside the program from an object.

EDIT: The issue is not with collection of children components but applying a list formed of them to TMP Dropdown.

Many thanks for the comments. I implemented antonsem’s script.

Unfortunately performance is still extremely poor. I think this related to TMP_Dropdown; I can debug log the names of the +5000 components without an issue but when they are added to TMP_Dropdown ( dropdown.AddOptions(names); - that I added after the for loop).

The performance is so bad it takes minutes just to stop running the program.
log the names of the +5000 components without an issue but when they are added to TMP_Dropdown ( dropdown.AddOptions(names); - that I added after the for loop).

EDIT:
Another weird thing I noticed is that the every name is applied to TMP_Dropdown three times for some strange reason. So lets say that part1 is one of the children, then the Dropdown has part1 in the list three times. The performance is accectable if I query only a limited amount of parts like 500 but gradually becomes worse when I try to list all +5000 parts (which is what I need to achieve).

@Bonfire-Boy provided an answer; I was wrongly referencing components where I just wanted the child’s name, hence tripling the amount of list items.
It now works, although TMP Dropdown performance is quite poor on AR / Mobile when it has many options.