Skip to content

Use protocol media registry for static types - #66

Merged
samuel-williams-shopify merged 1 commit into
mainfrom
migrate-protocol-media-registry
Aug 12, 2026
Merged

Use protocol media registry for static types#66
samuel-williams-shopify merged 1 commit into
mainfrom
migrate-protocol-media-registry

Conversation

@samuel-williams-shopify

@samuel-williams-shopify samuel-williams-shopify commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • replace mime-types with protocol-media-registry for static file media types
  • make configured extensions explicit, including separate webm and weba entries
  • use the registry’s more specific audio/vorbis and audio/speex mappings
  • remove obsolete Annodex entries and update static middleware documentation

Memory usage

Incremental RSS was sampled with process-metrics in fresh Ruby 4.0.6 processes. Each result is the median of 20 runs, except the fallback measurement which used 12 runs.

Library Require only After 46 Utopia lookups
mime-types 3.7.0 4.89 MiB 4.98 MiB
protocol-media-registry 0.1.0 native 1.33 MiB 1.53 MiB
protocol-media-registry Ruby fallback 5.00 MiB 5.03 MiB

The native registry saves approximately 3.5 MiB, or 70% of incremental RSS, after lookups. The memory improvement depends on the native index loading successfully; the Ruby fallback uses approximately the same memory as mime-types.

Testing

  • bundle exec sus test/utopia/static.rb
  • bundle exec rubocop lib/utopia/static/mime_types.rb lib/utopia/static/middleware.rb test/utopia/static.rb utopia.gemspec

The full suite reached 324 passing tests; four command-generation tests errored while creating temporary bundles because the local vendor/bundle contains native extensions built against a different Ruby build.

Signed-off-by: Samuel Williams <samuel.williams@shopify.com>
Assisted-By: devx/9ac9c17d-46f2-438f-b727-cfbed0fda374
@samuel-williams-shopify
samuel-williams-shopify merged commit 3d6f111 into main Aug 12, 2026
22 of 40 checks passed
@samuel-williams-shopify
samuel-williams-shopify deleted the migrate-protocol-media-registry branch August 12, 2026 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant