SGA-A / c2c

Source code for the custom app exclusive to cc, where most interactions begin and end.
MIT License
0 stars 0 forks source link

Generator usage in place of paginators that loop over lists #146

Open SGA-A opened 1 month ago

SGA-A commented 1 month ago

Is your feature request related to a problem? Please describe. Paginators are notoriously known for storing large amounts of data. If a paginators stores pages that could (potentially) contain a list millions of rows of data, this causes a big memory usage spike that will only become a bigger problem as our bot grows.

Describe the solution you'd like Every generator from now on must store data or fetch data with the use of generators. Look into how generators work, how it's used and most importantly how to handle it.

Describe alternatives you've considered None

Additional context Lists in python are very dynamic and cover the vast majority of use cases like looping over specific indexes etc. Generators on the other hand, create the objects in memory only when they are looped over by calling next(gen).

SGA-A commented 1 month ago

2 attempts were made, both to no avail, I feel because of the limited understanding I have about how generators work. For now, I'll have to look into documentation before digging into this issue later on:

SGA-A commented 1 week ago

I unlikely don't have any more time left to look into this. Since the code is often paginating over connection query results, I may need to look into the row_factory attr for SQLite python wrapper docs.

I do believe it is possible to allow fetches to return generators but as of right now I've not looked into this much yet.