Cuberite Forum
r339 - Server uses ~40% less CPU now - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Development (https://forum.cuberite.org/forum-13.html)
+--- Thread: r339 - Server uses ~40% less CPU now (/thread-371.html)



r339 - Server uses ~40% less CPU now - tbar - 02-29-2012

The commit log for rev 339 states:
  • Server uses ~40% less CPU now
This sounds amazing!Big Grin:D How did you pull that off?


RE: r339 - Server uses ~40% less CPU now - xoft - 02-29-2012

I guess it depends - it's the amount chopped off of the tick thread, which itself runs at about 5 % CPU on my machine, so that means now it will run at like 3 % CPU I guess Wink
But maybe I'm wrong, I myself am wondering about the big change FakeTruth did Smile


RE: r339 - Server uses ~40% less CPU now - FakeTruth - 02-29-2012

Apparently the copying of an empty std::map or std::deque 400 times a tick takes a lot of time, so I made a check to see if it contains anything before doing anything else. This brought my CPU from ~10% down to ~6% so, whateverTongue


RE: r339 - Server uses ~40% less CPU now - xoft - 02-29-2012

You might save even more if you use std::swap() instead of copying