Storing 3000+ elements in an array

Storing 3000+ elements in an array

Hi,

I have a very particular use case. I need to store 3000+ throwable domains in an array for a custom function.
Use case: whenever a lead is created I want to check if the email provided by the lead is within these domains or not, we have a 3rd party mail verification workflow but want to reduce costs via such methods.

The issue is that upon storing such a large amount of elements, the web editor in CRM begins to lag and eventually it crashes.   

Is there any workaround or way to achieve my goal here?