2018-03-07, 19:11
I'm working on updating my addon to be python 2 and python 3 compliant. In addition to that, I'm trying to make it a little more efficient in returning listitem results.
This addon is different than most in that it can return a lot of results (on the order of thousands) for the user depending on how they use the addon. My goal is to try and make my plugin as efficient as possible in returning listitems. Currently, the addon works like this:
1) User selects a listitem to pull up a larger list of items
2) Plugin parses an xml file into a dict
3) The dict is saved (using python pickle) to the plugin userdata folder so it doesnt have to be re-parsed if the user comes back to the same list
4) The dict is massaged to populate listitem objects and then add them to the directory
I've found in timing tests during debugging that #4 above can take quite a long time if the list is long. Is it possible for me to change this so that the listitem object(s) are saved (to disk or to RAM) directly, and then I can speed things up even more? As far as I can tell, pickle will not work as the object is not serializable (in python 2, maybe it will be possible with python 3?)
Has anyone else come up with an efficient method to save listitem objects?
Thanks!
This addon is different than most in that it can return a lot of results (on the order of thousands) for the user depending on how they use the addon. My goal is to try and make my plugin as efficient as possible in returning listitems. Currently, the addon works like this:
1) User selects a listitem to pull up a larger list of items
2) Plugin parses an xml file into a dict
3) The dict is saved (using python pickle) to the plugin userdata folder so it doesnt have to be re-parsed if the user comes back to the same list
4) The dict is massaged to populate listitem objects and then add them to the directory
I've found in timing tests during debugging that #4 above can take quite a long time if the list is long. Is it possible for me to change this so that the listitem object(s) are saved (to disk or to RAM) directly, and then I can speed things up even more? As far as I can tell, pickle will not work as the object is not serializable (in python 2, maybe it will be possible with python 3?)
Has anyone else come up with an efficient method to save listitem objects?
Thanks!