!GYgsRswGQFffVnbfvf:matrix.org

Jellyfin ๐Ÿ Development

4916 Members
Discussion for the Python based Jellyfin clients41 Servers

Load older messages


SenderMessageTime
19 Aug 2020
@mcarlton:nerdyredneck.netmcarltonthis is the line I was looking at yesterday that was puking and what made me think of making it a function instead. https://github.com/jellyfin/jellyfin-kodi/blob/master/jellyfin_kodi/helper/api.py#L9712:14:59
@oddstr13:matrix.orgOddstr13
In reply to @mcarlton:nerdyredneck.net
if we're slinging this thing through a dozen places or more, definitely want it in a function somewhere to call it
middleware of sorts deep in the API is what I'm thinking
12:15:06
@mcarlton:nerdyredneck.netmcarltonI'm suspicious of that causing dumb behavior. or at the very least slowing things down more12:16:46
@oddstr13:matrix.orgOddstr13like, here deep: https://github.com/jellyfin/jellyfin-kodi/blob/8b1b648dfabcd6a1ffe4245a1592dc123a03f1d7/jellyfin_kodi/jellyfin/http.py#L16012:17:03
@oddstr13:matrix.orgOddstr13it would have some performance impact of course, but I think it'd be negligible compared to API request round trip time12:18:21
@oddstr13:matrix.orgOddstr13 and I really don't want foo.get() or foo.get() all over the place 12:18:54
@oddstr13:matrix.orgOddstr13(code complexity rating is already complaining too much as is ๐Ÿ˜†)12:19:52
@mcarlton:nerdyredneck.netmcarltona movie object has 54 keys at the top level. and then more once you get into media streams, subtitles, actors, etc12:22:07
@mcarlton:nerdyredneck.netmcarlton a recursive dict comprehension to remove all None keys is going to be awful for performance 12:22:26
@iwalton3:matrix.orgiwalton3You could make a proxy object that obliterates None values only on access.12:22:52
@mcarlton:nerdyredneck.netmcarlton that's why I suggested that wrapper function instead. processing a ton of json every call vs basically doing 2 dict.get() when you need something 12:24:02
@mcarlton:nerdyredneck.netmcarltoni haven't benchmarked obviously, but i feel like it would take a crapload of lookups to match the time it takes to parse the json12:24:31
@iwalton3:matrix.orgiwalton3Generally I think it is safe to say you won't notice it.12:25:37
@mcarlton:nerdyredneck.netmcarltonit might be better now after I reworked the sync process. but my gut says that doing a dict comprehension on a few thousand songs is going to make a lot of smaller computers hurt12:28:58
@mcarlton:nerdyredneck.netmcarltoni suppose if we made it into a generator it might not be awful. maybe12:29:23
@iwalton3:matrix.orgiwalton3For reference it takes about 3 seconds for my PC to do 100,000,000 dict lookups in Python. (And store the result.)12:31:39
@mcarlton:nerdyredneck.netmcarltonhow long is it going to take a Pi to do that that's already struggling not to run out of memory during the sync process?12:32:13
@iwalton3:matrix.orgiwalton3I have no idea.12:32:35
@iwalton3:matrix.orgiwalton3Generally JSON parsing is more expensive, but I personally avoid needless re-processing of the API output as well.12:33:19
@mcarlton:nerdyredneck.netmcarltonwhat did you run to test that? i've got a pi sitting on my desk12:33:49
@iwalton3:matrix.orgiwalton3
a={โ€œaโ€: 0}
_ = [a[โ€œaโ€] for x in range(100000000)]

Which isnโ€™t the best test (it stores the answers), but I wanted a quick idea of the time needed here.

12:36:22
@iwalton3:matrix.orgiwalton3Also beware the quotes...12:37:26
@iwalton3:matrix.orgiwalton3(I really wish Unicode quotes werenโ€™t a thing.)12:38:03
@mcarlton:nerdyredneck.netmcarltonhahahaha yeah .... it killed itself12:38:09
@mcarlton:nerdyredneck.netmcarltonwithout the overhead of kodi12:38:13
@iwalton3:matrix.orgiwalton3But that was the number big enough to get my gaming PC to take time to do it, and it allocates a lot of RAM. There are better tests.12:38:55
@mcarlton:nerdyredneck.netmcarltonyeah. it's also a single entry dict, where as the ones we'd be looking at have like 50 entries and some nested several levels deep12:39:36
@mcarlton:nerdyredneck.netmcarlton10k is a slightly more realistic number, but that finishes near instantly since it's not doing any real work12:39:57
@mcarlton:nerdyredneck.netmcarltonthough now that I'm thinking about it, I wonder if the server changed to include everything is why we're having memory issues on some devices now13:10:22
@oddstr13:matrix.orgOddstr13
In reply to @mcarlton:nerdyredneck.net
a movie object has 54 keys at the top level. and then more once you get into media streams, subtitles, actors, etc
gimme such an example from 10.6.3 or unstable, it's dinner here now :P
13:27:42

Show newer messages


Back to Room ListRoom Version: 5