File tree Expand file tree Collapse file tree 1 file changed +0
-19
lines changed Expand file tree Collapse file tree 1 file changed +0
-19
lines changed Original file line number Diff line number Diff line change @@ -26,8 +26,6 @@ class Day16 extends Day
26
26
protected array $ valves = [];
27
27
protected static array $ cache = [];
28
28
protected array $ cache2 = [];
29
- protected const MAX_CACHE_SIZE = 1000000 ; // Reduced cache size
30
- private const CACHE_EVICTION_THRESHOLD = 900000 ; // Threshold for cache cleanup
31
29
32
30
public function solvePart1 (mixed $ input ): int |string |null
33
31
{
@@ -168,26 +166,9 @@ protected function findMaxPressureWithElephant(
168
166
// Cache the result with more aggressive eviction strategy
169
167
$ this ->cache2 [$ key ] = $ maxPressure ;
170
168
171
- /* if (count(self::$cache) > self::CACHE_EVICTION_THRESHOLD) {
172
- $this->cleanupCache();
173
- } */
174
-
175
169
return $ maxPressure ;
176
170
}
177
171
178
- private function cleanupCache (): void
179
- {
180
- $ cacheSize = count (self ::$ cache );
181
- $ itemsToRemove = $ cacheSize - self ::MAX_CACHE_SIZE / 2 ;
182
-
183
- if ($ itemsToRemove > 0 ) {
184
- $ keys = array_rand (self ::$ cache , $ itemsToRemove );
185
- foreach ($ keys as $ key ) {
186
- unset(self ::$ cache [$ key ]);
187
- }
188
- }
189
- }
190
-
191
172
protected function parseInput (mixed $ input ): Collection
192
173
{
193
174
return collect (is_array ($ input ) ? $ input : explode ("\n" , $ input ))
You can’t perform that action at this time.
0 commit comments