Open ksuprynowicz opened 11 months ago
In unoptimized version it runs at 1 frame per 3 second:
[11/21 00:04:21] [DEBUG] [overte.scriptengine] Script: "controllerScripts.js" Frame: 360 Slept (us): 1501464 Avg Updates (us): 14697 averageTimerPerFrame (us): 1412341 FPS: 0
After disabling hand gesture related parts it's better, but still incredibly slow:
[11/21 00:15:23] [DEBUG] [overte.scriptengine] Script: "controllerScripts.js" Frame: 60 Slept (us): 1222020 Avg Updates (us): 15447 averageTimerPerFrame (us): 1168147 FPS: 0
If equipEntity is also disabled then perfomance improves twice: [11/21 00:33:54] [DEBUG] [overte.scriptengine] Script: "controllerScripts.js" Frame: 60 Slept (us): 962033 Avg Updates (us): 15718 averageTimerPerFrame (us): 897876 FPS: 0
On unoptimized build controller scripts get just 10 FPS with only squeezeHands.js:
[11/21 00:44:52] [DEBUG] [overte.scriptengine] Script: "controllerScripts.js" Frame: 840 Slept (us): 75825 Avg Updates (us): 16361 averageTimerPerFrame (us): 59576 FPS: 10
And 25 FPS with only grab.js:
[11/21 00:57:46] [DEBUG] [overte.scriptengine] Script: "controllerScripts.js" Frame: 3660 Slept (us): 40170 Avg Updates (us): 3 averageTimerPerFrame (us): 27129 FPS: 25
The controller scripts seem to be way faster in smaller worlds, like for example tutorial world, and extremely slow in large worlds like Overte Hub. This probably means that some part is getting too many entities.
It looks like Controller.Standard.RightHand is very slow for some reason, about 1.5 ms per call.
It looks like most of the time is consumed getting Controller.Standard. If it's cached as a variable then the call is almost for free. Here are profiling results for Controller.Standard.RightHand without caching:
This is probably related to https://github.com/overte-org/overte/issues/707
Controller scripts are currently extremely slow:
[11/20 19:44:3[11/20 19:44:31] [DEBUG] [overte.scriptengine] Script: "controllerScripts.js" Frame: 4200 Slept (us): 127317 Avg Updates (us): 6694 averageTimerPerFrame (us): 97327 FPS: 61] [DEBUG] [overte.scriptengine] Script: "controllerScripts.js" Frame: 4200 Slept (us): 127317 Avg Updates (us): 6694 averageTimerPerFrame (us): 97327 FPS: 6
According to V8 profiling data it looks like parts thet aren't even currently used take a significant part of the processing time:
It looks like mostly converting entity properties to script values takes a lot of time: