Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

change output for mget to dict #52

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AlKorochkin
Copy link

@AlKorochkin AlKorochkin commented Feb 20, 2020

Hello,

Used RedisTimeSeries v1.2.2/redistimeseries-py v0.8.0

Now mget return list of dict objects like:

[
    {'TestKey-0': [{}, 1582184963941, 4.5]}, 
    {'TestKey-1': [{}, 1582184963960, 4.5]},
    ...n
]

Such a format does not allow direct access to elements by key.
This makes iterate over the list and access the dictionary objects to get its key or value.
With a large number of elements, this is expensive.

It may be worth changing the output format for mget to:

{
    'TestKey-0': ({}, 1582184963941, 4.5), 
    'TestKey-1': ({}, 1582184963960, 4.5),
    ...n
}

This will allow to get the dict values directly, without iterating through the list. It structure in theory can save some memory.

@gkorland gkorland requested review from ashtul and danni-m February 20, 2020 12:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant