View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0001896 | Spring engine | Lua | public | 2010-04-22 18:03 | 2010-04-30 12:18 |
| Reporter | dfreeman | Assigned To | |||
| Priority | normal | Severity | major | Reproducibility | have not tried |
| Status | closed | Resolution | won't fix | ||
| Product Version | 0.81.2.1 | ||||
| Summary | 0001896: MT-SIM has bad CPU load due to UI and draw world | ||||
| Description | I was having high CPU load in very large games, so I tried compiling MT-SIM. I am using a Core2 Duo with ATI on a Dell Studio 15 laptop. Going to MT-SIM gave better performance at light load, but became unusable at higher loads. I found that draw world and UI were both over 40% each, with the total getting to 100% in situations where it would have still been usable without multithreading. I then went back to single thread and found draw world and UI were more like 20-25%. There is more lag when clicking on things, but the game is quite playable in comparison. | ||||
| Tags | No tags attached. | ||||
| Checked infolog.txt for Errors | |||||
|
|
Not really, the problem is LUA related. http://springrts.com/wiki/OtherDownloads "Some widgets may cause very high CPU load" Unfortunately there is currently no way to resolve this issue, the problem lies in the LUA UI widgets themselves. Because they are single threaded (not containing any synchronization), the Sim must basically be halted whenever a graphical widget is drawing its stuff. "Gravel in the machinery" as we would say in Sweden. Disable all graphical widgets, and your CPU% should be fine. If someone has a clever idea to work around this issue, feel free to contact me. |
|
|
That's true, I did turn off all the widgets and it ran fast.. but still I couldn't play BA 7.12 without RedUI. I haven't looked at the code, but I've been wondering this for a little while. Could you double-buffer the simulation? I don't mind if the UI looks at a slightly older view of the world. That's what happens anyway if my CPU can't keep up. If the simulation used double-buffered data, would that make it possible to multithread the simulation itself? Surely there is a lot of parallelism in a physics simulation. I don't know how much data the simulation operates on, perhaps it can be copy-on-write instead of a full second buffer. Then every time the UI finishes rendering it flushes the old copies that are no longer referenced from the current data structures. |
|
|
Yes, I've been considering things like this but I rejected it for complexity/performance reasons. Dumping a copy of the entire Sim state takes too much CPU time. The best solution as I see it is to require special MT-certified LUA scripts that contain proper synchronization. Non certified scripts will fail to load. I don't have enough time to do large amounts of LUA coding but possibly I can find some time to expose the necessary synchronization primitives to LUA. Sim cannot be threaded (or at least we don't know how to) because it is synced - i.e. must produce identical results on all machines. |
|
|
Will clarify on the download page that any UI widgets should be avoided. |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2010-04-22 18:03 | dfreeman | New Issue | |
| 2010-04-23 15:39 | zerver | Note Added: 0004842 | |
| 2010-04-24 06:43 | dfreeman | Note Added: 0004846 | |
| 2010-04-24 18:13 | zerver | Note Added: 0004848 | |
| 2010-04-30 12:18 | zerver | Note Added: 0004864 | |
| 2010-04-30 12:18 | zerver | Status | new => closed |
| 2010-04-30 12:18 | zerver | Resolution | open => won't fix |