forked from 0x2620/pandora
Cache serialized entities when fetching many annotations
For a scene with ~5600 annotations, of which ~3100 are entities, this cuts fetching the scene from 12 seconds to 2 seconds.
This commit is contained in:
parent
eebb0b5681
commit
8759b569da
3 changed files with 42 additions and 11 deletions
|
|
@ -100,7 +100,11 @@ def findAnnotations(request, data):
|
|||
qs = order_query(query['qs'], query['sort'])
|
||||
if 'keys' in data:
|
||||
qs = qs.select_related()[query['range'][0]:query['range'][1]]
|
||||
response['data']['items'] = [p.json(keys=data['keys']) for p in qs]
|
||||
entity_cache = {}
|
||||
response['data']['items'] = [
|
||||
p.json(keys=data['keys'], entity_cache=entity_cache)
|
||||
for p in qs
|
||||
]
|
||||
elif 'position' in query:
|
||||
ids = [i.public_id for i in qs]
|
||||
data['conditions'] = data['conditions'] + {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue