Skip to content

perf: Don't dynamic-import builtin deflate decoder - #483

Merged
kylebarron merged 2 commits into
mainfrom
kyle/deflate-not-dynamic
Apr 27, 2026
Merged

kylebarron merged 2 commits into
mainfrom
kyle/deflate-not-dynamic

Conversation

@kylebarron

@kylebarron kylebarron commented Apr 27, 2026 •

Copy link
Copy Markdown
Member

Changes

  • Remove dynamic import of deflate.ts. deflate.ts is just a wrapper around the native DecompressionStream API — it has zero deps and the 0.42 kB chunk is purely HTTP overhead (an extra roundtrip on the critical path before a tile can render). Inlining it costs ~400 bytes in the main bundle and removes a network hop.
  • Inline copyIfViewNotFullBuffer into lzw.ts and zstd.ts, which means that we can avoid creating a standalone utils.ts chunk (that would be imported by both of them)

Closes #428

For now we keep other decoders as dynamically imported

@kylebarron
kylebarron enabled auto-merge (squash) April 27, 2026 17:47
@kylebarron
kylebarron merged commit e9e927f into main Apr 27, 2026
4 checks passed
@kylebarron
kylebarron deleted the kyle/deflate-not-dynamic branch April 27, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

geotiff: Don't dynamic import tiny decompressors?

1 participant