Is there an existing issue for this?
What happened?
Where : backend/app/database/images.py
What happened ? : images.sort(key=lambda x: x["path"]) is performed in memory in db_get_all_images.
What should be : Use ORDER BY path in the SQL query and rely on it (removing the Python-side sort).
Why?: Sorting a massive list of dictionaries in Python is CPU intensive and redundant since the DB can do it faster.
Record
Is there an existing issue for this?
What happened?
Where :
backend/app/database/images.pyWhat happened ? :
images.sort(key=lambda x: x["path"])is performed in memory indb_get_all_images.What should be : Use
ORDER BYpath in theSQLquery and rely on it (removing the Python-side sort).Why?: Sorting a massive list of dictionaries in Python is CPU intensive and redundant since the DB can do it faster.
Record