last() is slow
Author: jakobzCreated Aug 30, 2023Updated Aug 30, 2023
last() function is slow due to excess array copying to merge all nationalities: https://github.com/chancejs/chancejs/blob/1b38c961b9c8c2cb7929c6b5e1f5d4ad788b23e1/chance.js#L1028
My code generates 10k persons, and it takes ~10-20 secs to do this. With no last() calls it's instant.
Workaround: c.last({ nationality: c.pickone(nationalities) });
Source: chancejs/chancejs