Cache serving pipeline fleet to eliminate per-tick rebuilds and reduce GC pressure
Fleet template is now rebuilt only when deploymentVersion changes (~68 times per 28,800-tick run instead of every tick). Reuses module-level Maps, arrays, and utilization objects instead of allocating new ones each tick. Replaces 4x Object.values().reduce() with single-pass aggregation and sorts fleet in-place. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1085,6 +1085,7 @@ export const useGameStore = create<Store>()(
|
||||
productLines: s.models.productLines.map(pl => ({
|
||||
...pl, modelId, isActive: true,
|
||||
})),
|
||||
deploymentVersion: s.models.deploymentVersion + 1,
|
||||
},
|
||||
market: {
|
||||
...s.market,
|
||||
@@ -1104,6 +1105,7 @@ export const useGameStore = create<Store>()(
|
||||
? { ...f, variants: f.variants.map(v => v.id === variantId ? { ...v, isDeployed: true } : v) }
|
||||
: f,
|
||||
),
|
||||
deploymentVersion: s.models.deploymentVersion + 1,
|
||||
},
|
||||
}));
|
||||
get().addNotification({ title: 'Variant Deployed', message: 'Variant is now live.', type: 'success', tick: get().meta.tickCount });
|
||||
|
||||
Reference in New Issue
Block a user