perf(server): index profile equipment and research refreshes
Replace O(N^2) linear lookups and repeated array filtering across modifications, weapons, modsResearch and unitResearch with single-pass Map indexes, pre-sort catalogue equipment once on load, avoid redundant pre-change disk writes in PlayerProfiles.updateWhen, and shallow-copy only top-level lists in clientProfile.
This commit is contained in:
1 parent
ebb2937a38
commit
62da2e3038
10 files changed
+401
-155
No files matched your search
@@ -15,7 +15,12 @@ import { clearStoreCart } from './profile-store-cart.ts';
|
||||
import { serverTimeNow } from './server-time.ts';
|
||||
|
||||
export function clientProfile(saved: BlkBlock, account: Account): BlkBlock {
|
||||
const profile = structuredClone(saved);
|
||||
// Shallow-copy only the top-level lists; child blocks are never mutated here.
|
||||
const profile: BlkBlock = {
|
||||
name: saved.name,
|
||||
params: [...saved.params],
|
||||
blocks: [...saved.blocks],
|
||||
};
|
||||
clearStoreCart(profile);
|
||||
const pilotIcon = appearance(profile).pilotIcon || DEFAULT_PILOT_ICON;
|
||||
setParam(profile, 'pilotIcon', { type: 'string', value: pilotIcon });
|
||||
|
||||
Reference in new issue
Block a user