Poor performance when creating linked entities
Shiwa opened this issue · comments
Hi,
I’ve been trying mswjs/data to mock our APIs and found it quite nice… until I tried with "larger" datasets:
- one account
- having a list of 100 clients
- each client have some invoices, which have some due dates
- and a few other entities in very small number (<10)
Problem arise when increasing the number of invoices & due dates.
With 1 invoice with 1 due date per client (100 / 100 total), data generation takes ~1s on my laptop (a recent i7-1270P with 32Gb of ram, not filled). Not ideal for automated testing but still manageable.
With 5 invoices (1 due date each) per client (500 / 500 total), data generation takes 34s…
With 5 invoices with 5 due dates each, firefox asks me if I want to go into debug because the page froze.
I ran the profiler and most of the generation time is spent in the "defineRelationalProperties" function :
Since invoices are an important entity in our app and we want to test pagination with 100+ items, it’s a blocking problem for us.