Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High CPU usage on client/server threads #5

Open
avelgest opened this issue Dec 15, 2023 · 2 comments
Open

High CPU usage on client/server threads #5

avelgest opened this issue Dec 15, 2023 · 2 comments

Comments

@avelgest
Copy link

Really helpful add-on!
There's a small issue at the moment that the Blender Layer client and server are constantly sending and receiving messages (most of which are empty lists) causing high CPU usage on two cores.

I've made a commit on my fork which uses selectors to wait for messages. Changing to waiting for messages resulted in a several bugs due to race conditions, but I think they're all fixed in the above commit.

Would you be open to a pull request? Some parts might be a bit rough at present, but it doesn't seem to have broken anything so far as I can tell!

@Yuntokon
Copy link
Owner

Hey, sorry for the late reply, this definitely has been something on my todo list!
(Although I am curious whether the impact on CPU usage is actually measurable, have you experienced any issues or did you just notice how hacky the code is?). You code definitely looks much more elegant than the current approach.

In principle I am open to pull requests, but I would have to take a closer look to see if this is causing any problems on my side, especially since I have some planned changes, that would also include sending texture data back to Blender.
Additionally, I'm currently somewhat busy with other projects, so it might take a while for me to properly get to this.

@avelgest
Copy link
Author

Thanks for the reply!
On both of the machines I've tested on the client and server threads utilize most of a CPU core each, so it's quite easily noticeable on my 4 core laptop (audibly so!). Issue-wise it doesn't stop anything from working, but just negatively impacts performance and power usage.

Definitely agree that the changes would need a closer look. I've found a few bugs in my original commit since posting (fixed in this commit). I'll keep this branch updated if I find any more.

Good to hear that there are more updates planned! And good luck with your other projects!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants