View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0002839 | Spring engine | General | public | 2011-12-15 23:10 | 2012-04-07 03:49 |
| Reporter | jK | Assigned To | |||
| Priority | normal | Severity | major | Reproducibility | have not tried |
| Status | closed | Resolution | suspended | ||
| Product Version | 84.0.1 | ||||
| Target Version | 85.0 | ||||
| Summary | 0002839: CPU spikes in QT- & legacy PFS | ||||
| Description | Just let 2 CAIs fight against each other. 1. CPU spikes every few seconds even with <50 units on the map 2. units can't path around static buildings like solars & factories (semi-fixed) | ||||
| Tags | No tags attached. | ||||
| Attached Files | |||||
| Checked infolog.txt for Errors | |||||
|
|
It seems certain buildings are now non-blocking for certain units (test-case: armsolar vs. armflash in BA 7.62), so both pathfinders ignore them completely. At least that explains 2, can't say anything about 1. |
|
|
fixed 2, could not reproduce 1 |
|
|
(1) is caused by PathManager::RequestNewPath() which spends 100% of the time in ::GetPath(). It calls it multiple times on a call and even sometimes with the same arguments (and same res). (Note: it's not the total time spend in RequestNewPath(), that's marginal. It's the time spend per call that cause the spikes.) |
|
|
I expect the spikes are due to this* change by zerver (which is in 84.0 already) which makes RequestPath fall back to the MAXIMUM-resolution pathfinder in two cases where previously only medium- or low-resolution fallback searches were done (which was my strict intention for that code, max-res queries are _expensive_ over long distances and a major reason why I wrote QTPFS). (There were no changes to the default pathfinder since 84.0 and pathfollowing code did not change in a way that would cause more path requests to be issued, so no other explanation comes to mind) * https://github.com/spring/spring/commit/77b1f2a840f4aed878190d8417ba846931e3b66a |
|
|
It's not only zerver's change. In my profilings runs PathManager::RequestNewPath() spend 50% directly in ::GetPath and the other 50% in CPathManager::MedRes2MaxRes(), which itself spend 100% in ::GetPath(). Good to know that QTPFS should fix this. Still it got similar spikes (from the graph it's in Update() there), so I thought it would be the same issue. Probably need to make an oprofile there, too. |
|
|
Hmm, that graph shows ~ 22 percent of the CPU time per SimFrame is actually spent in PathManager::Update --> legacy PathEstimator::Update, which is responsible for repathing after the terrain changes. I think it can be quickfixed by lowering the SQUARES_TO_UPDATE constant, but a factor to consider is that ZK uses terraforming etc much more heavily than other games, maybe too much. |
|
|
Requote myself: "Note: it's not the total time spend in RequestNewPath(), that's marginal. It's the time spend per call that cause the spikes." The 22% in PathManager::Update aren't perfect, but don't matter that much cause they are shared smoothly across frames. PathManager::RequestNewPath() instead cause ways more ugly spikes you really notice in your FPS & scrolling. |
|
|
I already told you why those short-lasting spikes are so much higher now than before, and I am not going to quote myself again. But since it does not seem to be obvious... "In my profilings runs PathManager::RequestNewPath() spend 50% directly in ::GetPath and the other 50% in CPathManager::MedRes2MaxRes" 1) zerver's change means GetPath gets called more often by RequestPath 2) it also means the result of a search will be IPath::Ok more often --> RequestPath also calls MedRes2MaxRes more often Furthermore there is this --> https://github.com/spring/spring/commit/d97b3c65986e5192b0b925990a0d05fcc3c2edef <-- commit which quadruples the time spent in low-level MoveMath functions. |
|
|
added qtpfs profile run (note, the pathing was broken that's why I also included the demo, so units didn't found their way in >50% of the cases) |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2011-12-15 23:10 | jK | New Issue | |
| 2011-12-15 23:43 | Kloot | Note Added: 0007922 | |
| 2011-12-15 23:47 | jK | File Added: pathfinder_spikes.jpeg | |
| 2011-12-15 23:49 | Kloot | Note Edited: 0007922 | |
| 2011-12-16 03:27 | Kloot | Note Edited: 0007922 | |
| 2011-12-16 03:28 | Kloot | Note Added: 0007923 | |
| 2011-12-17 12:01 | jK | Note Added: 0007933 | |
| 2011-12-17 12:02 | jK | Note Edited: 0007933 | |
| 2011-12-17 12:02 | jK | Note Edited: 0007933 | |
| 2011-12-17 12:08 | jK | Note Edited: 0007933 | |
| 2011-12-17 13:49 | Kloot | Note Added: 0007934 | |
| 2011-12-17 13:51 | Kloot | Note Edited: 0007934 | |
| 2011-12-17 18:40 | jK | Note Added: 0007937 | |
| 2011-12-17 18:42 | jK | Note Edited: 0007937 | |
| 2011-12-17 18:43 | jK | Note Edited: 0007937 | |
| 2011-12-17 18:46 | jK | File Added: profile.png | |
| 2011-12-17 20:09 | Kloot | Note Added: 0007939 | |
| 2011-12-17 20:09 | Kloot | Note Edited: 0007939 | |
| 2011-12-17 20:10 | Kloot | Note Edited: 0007939 | |
| 2011-12-17 20:13 | jK | Note Added: 0007941 | |
| 2011-12-17 20:14 | jK | Note Edited: 0007941 | |
| 2011-12-17 20:14 | jK | Note Edited: 0007941 | |
| 2011-12-17 20:49 | Kloot | Note Added: 0007942 | |
| 2011-12-17 20:51 | Kloot | Note Edited: 0007942 | |
| 2011-12-18 12:42 | Kloot | Note Edited: 0007942 | |
| 2011-12-19 12:47 | jK | File Added: profile_qtpfs.png | |
| 2011-12-19 12:52 | jK | File Added: Crossing_4_final_84.0.1-559-gda811f9_qtpfs.sdf | |
| 2011-12-19 20:41 | jK | Note Added: 0007972 | |
| 2011-12-23 15:49 | jK | Summary | Pathing is totally broken (QTPFS & Legacy) => CPU spikes in QT- & legacy PFS |
| 2011-12-23 15:49 | jK | Description Updated | |
| 2012-04-07 03:49 | jK | Status | new => closed |
| 2012-04-07 03:49 | jK | Resolution | open => suspended |