Skip to content

Commit ffb1e01

Browse files
committed
Fix shutdown performance regression
1 parent 0fc7d43 commit ffb1e01

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

Core/HLE/AtracCtx2.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@
2929
// cmd1> C:\dev\ppsspp\pspautotests\tests\audio\atrac>copy /Y ..\..\..\__testoutput.txt stream.expected
3030
// Then run the test, see above.
3131

32-
// TODO: Add an AT3 dumping facility (and/or replacement?). Although the old implementation could do it more easily...
33-
34-
3532
struct AT3BitrateMeta {
3633
u16 sampleSize;
3734
u8 dataByte;

Core/MIPS/JitCommon/JitBlockCache.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,11 @@ void JitBlockCache::Shutdown() {
120120
// This clears the JIT cache. It's called from JitCache.cpp when the JIT cache
121121
// is full and when saving and loading states.
122122
void JitBlockCache::Clear() {
123+
// Note: We intentionally clear the block_map_ first to avoid O(N^2) behavior in RemoveBlockMap
124+
block_map_.clear();
123125
for (int i = 0; i < num_blocks_; i++) {
124126
DestroyBlock(i, DestroyType::CLEAR);
125127
}
126-
block_map_.clear();
127128
proxyBlockMap_.clear();
128129
links_to_.clear();
129130
num_blocks_ = 0;
@@ -238,6 +239,7 @@ void JitBlockCache::RemoveBlockMap(int block_num) {
238239
// TODO: This is O(n), so O(n^2) when called for every block.
239240
for (auto it = block_map_.begin(); it != block_map_.end(); ++it) {
240241
if (it->second == (u32)block_num) {
242+
_dbg_assert_(false);
241243
block_map_.erase(it);
242244
break;
243245
}

0 commit comments

Comments
 (0)