In my tests with profiling, using yappi and valgrind, I see that in get_packages from server/init.py, 35% of the time is consumed in _get_po_list which is called for each package (27 000 in my case).
The first improvement is in _get_id function. Initially, this function prepares a set, then appends the last value according to a test. Now, the whole is declared according to the result of the test.
The second improvement is a conditional test on the fields to return from the GetPackages call. If the set of fields is ['summary', 'size', 'group'], I call a specific function get_packages_ndsg which return directly the attributes without testing them.
Now the improvement is about 20% of the the duration of loading cache.
In my tests with profiling, using yappi and valgrind, I see that in get_packages from server/init.py, 35% of the time is consumed in _get_po_list which is called for each package (27 000 in my case). The first improvement is in _get_id function. Initially, this function prepares a set, then appends the last value according to a test. Now, the whole is declared according to the result of the test. The second improvement is a conditional test on the fields to return from the GetPackages call. If the set of fields is ['summary', 'size', 'group'], I call a specific function get_packages_ndsg which return directly the attributes without testing them.
Now the improvement is about 20% of the the duration of loading cache.