Skip to content

oci: casext: mediatype: switch to generics for parser functions #476

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

cyphar
Copy link
Member

@cyphar cyphar commented May 18, 2023

We cannot use generics for the parser function map, but we can use it when instantiating "simple" JSON parser functions. There are a few other downsides to Go's generics, so this should just be a minor (possibly even theoretical) performance improvement over constructing the parsed types using reflection.

@codecov-commenter
Copy link

codecov-commenter commented May 18, 2023

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 81.81818% with 6 lines in your changes missing coverage. Please review.

Project coverage is 73.68%. Comparing base (3405ba8) to head (71d012d).
Report is 21 commits behind head on main.

Files with missing lines Patch % Lines
oci/casext/mediatype/parse.go 81.81% 4 Missing and 2 partials ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main     #476       +/-   ##
===========================================
+ Coverage   46.37%   73.68%   +27.31%     
===========================================
  Files          60       60               
  Lines        4895     4903        +8     
===========================================
+ Hits         2270     3613     +1343     
+ Misses       2357      941     -1416     
- Partials      268      349       +81     
Files with missing lines Coverage Δ
oci/casext/mediatype/parse.go 76.69% <81.81%> (+5.12%) ⬆️

... and 32 files with indirect coverage changes

@cyphar cyphar marked this pull request as ready for review May 18, 2023 10:02
We cannot use generics for the parser function map, but we can use it
when instantiating "simple" JSON parser functions. There are a few other
downsides to Go's generics, so this should just be a minor (possibly
even theoretical) performance improvement over constructing the parsed
types using reflection.

Signed-off-by: Aleksa Sarai <[email protected]>
@cyphar cyphar merged commit d2ba031 into opencontainers:main Nov 27, 2024
16 checks passed
@cyphar cyphar deleted the generics branch November 27, 2024 23:10
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.

2 participants