Repository navigation
Conversation
Every Shape and ShapeRef created an empty metadata Hash, though most never get any metadata. Loading the S3 and KMS APIs left 3,833 of them, about 0.6 MB of Ruby objects. Create the Hash on the first []= instead; [] reads nil as no metadata. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Every
Seahorse::Model::Shapes::ShapeandShapeRefcreates an empty metadata Hash ininitialize, though most of them never get any metadata. This creates it on the first[]=instead, and[]reads a missing Hash as no metadata. It's a small one, next to #3465: about 0.6 MB less per process for S3 and KMS, and the same for every other service API an app loads.Loading the S3 and KMS APIs (
ClientApi::API), onversion-3at 1419898 and with this change, Ruby 4.0.9:version-3ObjectSpace.memsize_of_allLoad time doesn't change (within noise, interpreter and YJIT). Query-protocol responses (STS, SQS, SNS, IAM) also allocate 3 Hashes less each, since
Query::Handler#rulesbuilds a shape and two refs per response.Every metadata read on the S3 and KMS models (4,273 shape, ref and operation reads over 27 keys, including one that is never set) gives the same values before and after.
aws-sdk-core(2,496 examples) andaws-sdk-s3(1,721) specs pass, and the new spec covers reading metadata that was never set.OperationandApikeep their eager Hash, there are only a few of them. Would you like those changed too for consistency, or is it fine to keep this one narrow?By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Generated with Claude Code, but prompted, read, and verified by @czj, a caring human :)