Skip to content
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

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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

Codecov Report

Merging #476 (11a8818) into main (899f30e) will increase coverage by 0.04%.
The diff coverage is 81.81%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #476      +/-   ##
==========================================
+ Coverage   73.34%   73.38%   +0.04%     
==========================================
  Files          60       60              
  Lines        4881     4889       +8     
==========================================
+ Hits         3580     3588       +8     
- Misses        940      941       +1     
+ Partials      361      360       -1     
Impacted Files Coverage Δ
oci/casext/mediatype/parse.go 76.69% <81.81%> (+1.96%) ⬆️

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 marked this pull request as ready for review May 18, 2023 10:02
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