Currently when generating products, each call to the generate method will in turn call the generate_term_ids method (twice, once for categories, once for tags), which may generate between 0 and 5 new taxonomy terms. That adds a lot of extra potential database queries, and can really slow down the product generation process.
There are a couple of different approaches we could take to mitigate this:
Use the same strategy that the Orders generator takes. If there aren't any existing category and/or tag terms, just create products without them. If there are existing terms, randomly assign them as usual.
Do create terms along with products, but create them all first, as a batch, and then randomly assign as usual.
I've already taken one step to address this issue with #117, so that term generation can be done as an entirely separate command before running generate products. The batch method in the Term class could also be used with approach 2 above.
Currently when generating products, each call to the
generate
method will in turn call thegenerate_term_ids
method (twice, once for categories, once for tags), which may generate between 0 and 5 new taxonomy terms. That adds a lot of extra potential database queries, and can really slow down the product generation process.There are a couple of different approaches we could take to mitigate this:
I've already taken one step to address this issue with #117, so that term generation can be done as an entirely separate command before running
generate products
. Thebatch
method in the Term class could also be used with approach 2 above.