Tips on making api.create() faster?


Lately I’ve noticed a performance issues with my site and using the bika.lims.api.create() function to create new content on my Senaite 2.x site. This occurs both when I run a manual session as well as during normal site usage. Creating new Samples using the AR-Add screen takes 30-60+ seconds to create new samples when there are 10-20 samples with 20 analyses or so on each.

One thing I noticed is that the function call throws a deprecation warning every time its called:
The isDiscussable method from the ExtensibleMetadata in Products.ATContentTypes has been deprecated and will be removed in Plone 5. This method belongs to the old discussion infrastructure that already has been replaced by in Plone 4.1

I’m not sure if this is related to the performance issues, but I would really like to find a way to speed up this process. I’m planning on migrating about 3,000 samples from another program into our Senaite site with about 27 analyses each or so, and currently it looks like it would take and hour or two instead of only a minute or so like I would expect for such a small dataset. On the other hand I can easily update thousands of analyses’ records in a few seconds, so I’m a bit confused why the creation process is a magnitude or two slower.