Skip to content

Commit 025d0a2

Browse files
committed
day 16 wip
1 parent d0ad882 commit 025d0a2

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

src/Days/Day16.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ class Day16 extends Day
2626
protected array $valves = [];
2727
protected static array $cache = [];
2828
protected array $cache2 = [];
29-
protected const MAX_CACHE_SIZE = 1000000; // Reduced cache size
30-
private const CACHE_EVICTION_THRESHOLD = 900000; // Threshold for cache cleanup
3129

3230
public function solvePart1(mixed $input): int|string|null
3331
{
@@ -168,26 +166,9 @@ protected function findMaxPressureWithElephant(
168166
// Cache the result with more aggressive eviction strategy
169167
$this->cache2[$key] = $maxPressure;
170168

171-
/* if (count(self::$cache) > self::CACHE_EVICTION_THRESHOLD) {
172-
$this->cleanupCache();
173-
} */
174-
175169
return $maxPressure;
176170
}
177171

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-
191172
protected function parseInput(mixed $input): Collection
192173
{
193174
return collect(is_array($input) ? $input : explode("\n", $input))

0 commit comments

Comments
 (0)