Closed amureki closed 9 months ago
@amureki, as a see it, we currently render the ratios part of the payload twice if you declare a specific ratio. We first serialize everything and overwrite it later. Avoiding this could resolve in a considerable performance boost. Would you care to provide a patch?
Greetings Johannes!
While doing bulk operations with images that involved this library, I noticed a noticeable difference in the serialization time compared to the standard DRF library. Here is a quick snippet that I am trying:
The results on my dev machine (MacBook M1, 16 Gb) are the following:
I believe that the issue comes from the serialization of this part: https://github.com/codingjoe/django-pictures/blob/main/pictures/contrib/rest_framework.py#L25-L38
We have plenty of combinations of aspect ratios and containers, each of them has to be serialized from
SimplePicture
object to its url, which leads to a heavy CPU-bound operation. However, I cannot yet come up with the solution to that problem. Would you have any ideas on this?Best, Rust