Optimize get_ascending and ListElementParents
Closes #481 (closed). Paves the way for #457 (closed) as it makes everything be a QuerySet instead of having complex and memory-intensive filtering, sorting and deduplicating code; everything is in SQL.
Benchmarks show that there is not much change on ListElementParents
, as there usually never are enough parents for the changes to be relevant. This saves a few milliseconds on SearchElements
and on the IIIF search API. The changes are mostly relevant in unusual contexts with a lot of parents and help cleaning up the element list code!
Edited by Erwan Rouchet