psl
psl copied to clipboard
Large Type\union Performance
Hi, I'm using Type\union with a large array of Type\literal_scalar (currently 1178 items) and running into some performance issues. Something like...
$options = Vec\map(
$largeArray,
fn (string $value): Type\TypeInterface => Type\literal_scalar($value);
);
Type\union($options)->assert('choice_value');
This only occurs when the value being checked is towards the end of the union.
Before getting into understanding the Type namespace and attempting to possibly debug this my question is - is there a better/faster approach already available I'm not using? Any advice appreciated.
Thanks!