Rall3n / galaxy-integration-amazon

GOG Galaxy 2.0 integration for the Amazon Games Launcher
GNU General Public License v3.0
317 stars 17 forks source link

Plugin persistently uses about 1-3% CPU #5

Closed micpp42 closed 4 years ago

micpp42 commented 4 years ago

I've noticed that when everything is sitting idle, the python process attached to this integration seems to sit using just a couple percent of CPU, while all the others are using 0%. So I'm wondering if there's something this plugin is checking continuously where other plugins only update it intermittently? image

Rall3n commented 4 years ago

Are you sure that the process belongs to this plugin? My usage is around 0 to 0.3%.

But if I had to guess, it could be the active SQLite database connection to the game database file.

micpp42 commented 4 years ago

When I check the path it does seem to be the one belonging to the Amazon plugin image If I get a chance soon I might poke around and try to see if I can figure out why it might be happening

Rall3n commented 4 years ago

@micpp42 Would you mind uploading the latest log file for the plugin? Contents could provide more insights.

micpp42 commented 4 years ago

plugin-amazon-c2cd2e29-8b02-35a9-86fc-3faf90255857.txt Here's my log file

micpp42 commented 4 years ago

Hi, so I poked around a bit with Process Monitor and it looks like what's causing the issue is the app seems to be persistently scanning through every uninstall entry in the Registry - I'm guessing this is how it detects which games are installed? I don't seem to be getting this behaviour from other plugins (which all tend to sit closer to 0% cpu) so I'm guessing what might be happening is that this process is running in full every time where other plugins basically cache it (or they're pulling it in a less resource-intensive manner)? image

Rall3n commented 4 years ago

Might have something to do with a little mistake I made which caused the plugin to check the local games twice per ping. But registry access in general could also be a huge performance eater.

I made some improvements which I will review and release mid next week.

Rall3n commented 4 years ago

@micpp42 I just released a new version of the plugin.

It replaces the registry for installed games with a query on a SQLite database. Please confirm if this performs better than before.

micpp42 commented 4 years ago

That looks like it's fixed it, thanks!