chancejs icon indicating copy to clipboard operation
chancejs copied to clipboard

last() is slow

Open jakobz opened this issue 2 years ago • 0 comments

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) });

jakobz avatar Aug 30 '23 20:08 jakobz