psl icon indicating copy to clipboard operation
psl copied to clipboard

Large Type\union Performance

Open rodnaph opened this issue 3 months ago • 0 comments

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');
Image

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!

rodnaph avatar Nov 06 '25 23:11 rodnaph