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

refactor: store __typename in value instead of separate entity #2626

Merged
merged 8 commits into from
Aug 26, 2024

Conversation

meskill
Copy link
Contributor

@meskill meskill commented Aug 7, 2024

Summary:
Refactor the way the value of __typename is stored along the data value itself. Usually, __typename is already provided by async_graphql library, but in some cases we need to resolve it on our side, like for union types.

Previously, special wrapper type TypeName was used to resolve this type and it was stored in the EvaluationContext and propagated to the async_graphql/jit implementation either through context or other wrapper types to implement the fragments logic and to provide field __typename itself.

Because field __typename is actually part of the values in graphQL I think it's reasonable to store that type info inside the property __typename for values we have (currently, only for union types since for other cases the typename could be inferred from the schema).

To implement this change, following code was changed:

  • extend JsonLike to make it easier to set the new fields to resolved values
  • trait TypedValue to abstract the typename operations on value
  • remove additional code and wrappers from graphql engines and utilize newly added trait

Issue Reference(s):
Fixes #... (Replace "..." with the issue number)

Build & Testing:

  • I ran cargo test successfully.
  • I have run ./lint.sh --mode=fix to fix all linting issues raised by ./lint.sh --mode=check.

Checklist:

  • I have added relevant unit & integration tests.
  • I have updated the documentation accordingly.
  • I have performed a self-review of my code.
  • PR follows the naming convention of <type>(<optional scope>): <title>

@github-actions github-actions bot added the type: chore Routine tasks like conversions, reorganization, and maintenance work. label Aug 7, 2024
Copy link

codecov bot commented Aug 7, 2024

Codecov Report

Attention: Patch coverage is 56.83453% with 60 lines in your changes missing coverage. Please review.

Project coverage is 86.31%. Comparing base (9a50f13) to head (d93aab2).
Report is 1 commits behind head on main.

Files Patch % Lines
src/core/jit/builder.rs 5.00% 19 Missing ⚠️
src/core/json/borrow.rs 0.00% 15 Missing ⚠️
src/core/json/serde.rs 0.00% 13 Missing ⚠️
src/core/json/graphql.rs 56.25% 7 Missing ⚠️
src/core/json/json_like_list.rs 68.75% 5 Missing ⚠️
src/core/ir/discriminator.rs 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2626      +/-   ##
==========================================
- Coverage   86.46%   86.31%   -0.15%     
==========================================
  Files         255      256       +1     
  Lines       24972    24999      +27     
==========================================
- Hits        21593    21579      -14     
- Misses       3379     3420      +41     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@karatakis karatakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks okay

@tusharmath tusharmath added the ci: benchmark Runs benchmarks label Aug 17, 2024
@tusharmath tusharmath marked this pull request as draft August 17, 2024 08:19
@meskill meskill added the ci: test-jit Run all integration tests for the JIT optimized engine label Aug 19, 2024
@meskill meskill marked this pull request as ready for review August 19, 2024 10:13
Copy link

github-actions bot commented Aug 19, 2024

🐰Bencher

ReportMon, August 26, 2024 at 10:40:34 UTC
Projecttailcall
Branch2626/merge
Testbedbenchmarking-runner

🚨 3 ALERTS: Threshold Boundary Limits exceeded!
BenchmarkMeasure (units)ViewValueLower BoundaryUpper Boundary
input/vars.missingLatency (nanoseconds (ns))🚨 (view plot | view alert)11.45 (+32.49%)11.12 (102.99%)
synth_nested_borrowLatency (nanoseconds (ns))🚨 (view plot | view alert)70,359.00 (+93.68%)67,839.56 (103.71%)
test_handle_request_jitLatency (nanoseconds (ns))🚨 (view plot | view alert)140,560.00 (+36.20%)131,729.87 (106.70%)

Click to view all benchmark results
BenchmarkLatencyLatency Results
nanoseconds (ns) | (Δ%)
Latency Upper Boundary
nanoseconds (ns) | (%)
from_json_bench✅ (view plot)6,227,400.00 (-0.42%)6,867,035.10 (90.69%)
group_by✅ (view plot)481.18 (-2.82%)536.18 (89.74%)
input/args.missing✅ (view plot)25.48 (-0.74%)28.47 (89.48%)
input/args.nested.existing✅ (view plot)46.01 (-3.09%)55.60 (82.74%)
input/args.nested.missing✅ (view plot)38.65 (-0.16%)40.83 (94.65%)
input/args.root✅ (view plot)43.36 (-0.65%)52.69 (82.30%)
input/headers.existing✅ (view plot)32.65 (+3.39%)34.08 (95.80%)
input/headers.missing✅ (view plot)31.62 (+3.21%)33.44 (94.54%)
input/value.missing✅ (view plot)23.36 (-0.07%)24.65 (94.75%)
input/value.nested.existing✅ (view plot)42.26 (-1.06%)45.78 (92.31%)
input/value.nested.missing✅ (view plot)34.80 (-5.68%)39.71 (87.65%)
input/value.root✅ (view plot)38.82 (+1.30%)41.08 (94.51%)
input/vars.existing✅ (view plot)8.37 (+1.81%)9.74 (85.91%)
input/vars.missing🚨 (view plot | view alert)11.45 (+32.49%)11.12 (102.99%)
synth_nested✅ (view plot)127,440.00 (+27.47%)195,838.58 (65.07%)
synth_nested_borrow🚨 (view plot | view alert)70,359.00 (+93.68%)67,839.56 (103.71%)
test_batched_body✅ (view plot)1,902.80 (-6.54%)2,475.66 (76.86%)
test_batched_body #2✅ (view plot)1,495,600.00 (-7.68%)1,765,041.42 (84.73%)
test_data_loader✅ (view plot)422,320.00 (+3.41%)477,732.38 (88.40%)
test_handle_request✅ (view plot)129,690.00 (-9.71%)153,862.84 (84.29%)
test_handle_request_jit🚨 (view plot | view alert)140,560.00 (+36.20%)131,729.87 (106.70%)
test_http_execute_method✅ (view plot)14,286.00 (-2.73%)16,828.64 (84.89%)
with_mustache_expressions✅ (view plot)1,088.20 (-2.32%)1,184.77 (91.85%)
with_mustache_literal✅ (view plot)691.28 (-3.47%)769.96 (89.78%)

Bencher - Continuous Benchmarking
View Public Perf Page
Docs | Repo | Chat | Help

Copy link

Action required: PR inactive for 5 days.
Status update or closure in 10 days.

@github-actions github-actions bot added the state: inactive No current action needed/possible; issue fixed, out of scope, or superseded. label Aug 26, 2024
@github-actions github-actions bot removed the state: inactive No current action needed/possible; issue fixed, out of scope, or superseded. label Aug 26, 2024
@tusharmath tusharmath merged commit 648c018 into main Aug 26, 2024
33 of 36 checks passed
@tusharmath tusharmath deleted the refactor/typename-in-value branch August 26, 2024 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci: benchmark Runs benchmarks ci: test-jit Run all integration tests for the JIT optimized engine type: chore Routine tasks like conversions, reorganization, and maintenance work.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants