Open Michal-Szczepaniak opened 6 years ago
Yes this is mostly toxcore. I have to "poll" toxcore every once in a while to keep online and get notified. I've tried to minimize impact by making the interval fairly long but tox/toxcore is simply not mobile-ready yet.
It does a whole lot of onion network DHT stuff and depending on the # of your friends grows in both network and CPU activity.
Is there no like toxcore callbacks to use instead of polling?
It already uses callbacks but the logic is like this:
The design is not "wrong" per se but they should provide the option to run this blocking so it can be put in a thread loop and wait for actual external events (networking etc.). My understanding is that because it's mostly UDP they need to actually periodically send pings to peers etc. so it cannot just "sit and listen for new packets". There's also the whole DHT facilitation but I'm not familiar enough to know what it entails.
There are a lot of issues open on their tracker related to performance/resource usage. See for example issue 441
So its more about toxcore than jtox itself is what you mean? Issue linked talks more about network usage rather than cpu usage tho
Sure but the CPU is most probably related to this event loop. Also the amount of networking resources is way past what you can afford on a phone (unless on wifi). It's just no there yet. You can try and "disconnect" the event loop after some amount of time to see if it stops the CPU. If you do find out it's not related I'm all about fixing of course.
Well purple have loop too and its working fine. Ill grab basic example and test using it and let ypu know if i find something.
Sure, thanks. I'm fairly sure that apart from the toxcore loop nothing should be executing. The only other things are animations but I'm fairly sure they get paused if you minimize the app and only happen in specific cases (e.g. offline msg. waiting to be sent etc.)
If you do find it's something out of toxcore I'll be more than happy to fix it.
I noticed that jtox has static usage of 5-6% cpu on snapdragon 810 which causes lower battery life. We need to find out what does that and mininalize that.