seriesoftubes/src/game/96-map
Antoine 57546ea18e
2D map: hold its pictures to 48 MB, letting go of those unused the longest
The 2D map keeps a canvas per picture, and the list was capped only by its length (1 400). A long zoom on a big
network paints every city again at each step of its scale, so a pinch from 0.6 to 3.2 and back held 181 MB of
pictures (the TTL save: 179 MB) where one frame uses 2 to 23 MB.

At the end of a frame over 48 MB, the pictures it did not use go, those unused the longest first, down to 36 MB, and
each canvas let go is emptied (0×0) so its pixels are freed without waiting for the collector. The frame's own
pictures are never let go, so a screen that needs more keeps what it needs. Finding a picture now marks it as used.

Measured in jsdom on the same pinch (1280×800 at 2×): 43 MB at most (TTL: 40 MB); 4 781 pictures painted against
4 083 (TTL: 5 549 against 6 030); at most 321 painted in one frame, the same as before (the zoom's own steps).
The card's atlas is unchanged: it has its own fixed size.
2026-11-05 00:21:34 +01:00
..
10-canvas.js Settings: one Diagnostic info readout for the screen, the map's drawing and its speed 2026-11-04 22:37:15 +01:00
20-land-and-clouds.js Faster routing and map: finished flows leave the rank loop, flows keep their exit table, lazy exit labels, off-screen links culled by box 2026-11-01 13:51:25 +01:00
30-settings.js Settings: one Diagnostic info readout for the screen, the map's drawing and its speed 2026-11-04 22:37:15 +01:00
40-level-of-detail.js Split the game page into partials under src/, assembled into one index.html at build 2026-10-27 10:05:56 +01:00
50-link-geometry.js Draw the map with WebGL2 by default, with the 2D canvas as fallback 2026-11-04 22:37:12 +01:00
55-link-look.js Draw the map with WebGL2 by default, with the 2D canvas as fallback 2026-11-04 22:37:12 +01:00
56-webgl.js WebGL map: free what the card holds when it is given up for good 2026-11-04 23:07:25 +01:00
57-webgl-background.js WebGL map: say how the land's stencil counts, and what the land costs the card 2026-11-05 00:21:33 +01:00
58-webgl-links.js WebGL map: give the card up for 2D when it runs out of memory without saying so 2026-11-04 22:37:15 +01:00
59-gl-sprites.js 2D map: hold its pictures to 48 MB, letting go of those unused the longest 2026-11-05 00:21:34 +01:00
60-draw.js 2D map: hold its pictures to 48 MB, letting go of those unused the longest 2026-11-05 00:21:34 +01:00
70-world-layer.js 2D map: keep the land picture on the graphics card in Firefox on a computer 2026-11-04 22:37:15 +01:00
75-city-size.js Map: cities show their size, and crowded small ones step back to a dot 2026-10-31 11:36:48 +01:00
80-cities.js WebGL map: keep the pictures' keys, the waves and the clouds out of the garbage 2026-11-04 22:37:14 +01:00
85-puzzle-cities.js Puzzles on phones: three goals in plain words with Show me, the problem marked on the map, a sheet that starts small, and a quieter map 2026-11-04 21:48:21 +01:00
87-chaos-monkey.js Badges: Met the Backhoe becomes Met the Chaos Monkey 2026-10-30 11:44:22 +01:00
88-cable-ships.js WebGL map: keep the cities' pictures while the zoom moves, paint them sharp once it rests 2026-11-04 22:37:13 +01:00
90-input.js Zoom in twice as far; ships at anchor keep clear of their port 2026-11-04 11:54:31 +00:00
95-clicks.js Draw the map with WebGL2 by default, with the 2D canvas as fallback 2026-11-04 22:37:12 +01:00
97-diagnostics.js Settings: one Diagnostic info readout for the screen, the map's drawing and its speed 2026-11-04 22:37:15 +01:00