Use protocol media registry for static types - #66
Merged
Conversation
Signed-off-by: Samuel Williams <samuel.williams@shopify.com> Assisted-By: devx/9ac9c17d-46f2-438f-b727-cfbed0fda374
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mime-typeswithprotocol-media-registryfor static file media typeswebmandwebaentriesaudio/vorbisandaudio/speexmappingsMemory usage
Incremental RSS was sampled with
process-metricsin fresh Ruby 4.0.6 processes. Each result is the median of 20 runs, except the fallback measurement which used 12 runs.mime-types3.7.0protocol-media-registry0.1.0 nativeprotocol-media-registryRuby fallbackThe 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.rbbundle exec rubocop lib/utopia/static/mime_types.rb lib/utopia/static/middleware.rb test/utopia/static.rb utopia.gemspecThe full suite reached 324 passing tests; four command-generation tests errored while creating temporary bundles because the local
vendor/bundlecontains native extensions built against a different Ruby build.