Assign Materials to 4000 GH Objects

in GH you can do it like this: (Key/Value Search Component)

EDIT:

There is also no big deal to sort your object by ID/Name,
just split the ID by ‘A’ and use the numbers for sorting