Open billw2012 opened 4 years ago
the namespace is always returned alphabetically sorted
That means backend always iterates and sorts entire thing, even if you only want a small part. And it has to repeat for every chunk, so when you want all it repeats that a dozen times
Well no, it would do it once when it first gets the request for actual items and cache it if you are that concerned about performance. I don't really understand why you are in this case, it currently takes 5-10 seconds to retrieve the full list anyway, this will be faster because sorting an array is very fast compared to that, and returning only 20 instead of 200000 will save massive amounts of time in serialization on both ends.
and cache it if you are that concerned about performance.
But you can only cache while game is frozen You would then in request, request how many results you want max, at what offset. You get back the results, and the number of total entries?
More like you just request the size for a namespace, then you request a page like { 'ns': 4, 'from': 0, 'count': 150}
. This is pretty typical in this type of API where you don't know the size of the dataset, or the dataset is massive, or only parts are needed at a time.
But you can only cache while game is frozen
Of course, I don't see the problem though.
This can be massive, even just getting the name list takes a few seconds on a small new game (I didn't try on a large in progress one yet!). I suggest: