Skip to content

BE-582: HashQL: Change opaque types from invariant to covariant#8835

Open
indietyp wants to merge 2 commits into
mainfrom
bm/be-582-hashql-make-opaque-types-covariant-in-their-inner
Open

BE-582: HashQL: Change opaque types from invariant to covariant#8835
indietyp wants to merge 2 commits into
mainfrom
bm/be-582-hashql-make-opaque-types-covariant-in-their-inner

Conversation

@indietyp

@indietyp indietyp commented Jun 8, 2026

Copy link
Copy Markdown
Member

🌟 What is the purpose of this PR?

Opaque types in HashQL were previously treated as invariant in their inner representation. This was overly restrictive: because HashQL values are immutable, there is no mutation-based unsoundness argument that would require invariance. This PR changes opaque types to be covariant, meaning W<A> <: W<B> whenever A <: B, while still preserving nominal separation between distinct opaque families.

This fixes a regression where expressions like W(A()) as W<A | B> would fail to type-check, because the solver could not propagate constraints through the opaque wrapper when the target type was a union. With covariance, the solver correctly decomposes W<?1> <: W<A | B> into ?1 <: A | B, and combined with the lower bound A <: ?1, resolves ?1 = A.

The is_top implementation for opaque types is also corrected: W<Unknown> is the top of the W fiber only, not the global top. Returning true previously caused T | W<Unknown> to incorrectly collapse to Unknown, destroying nominal separation between opaque families.

As a consequence of covariance, inference constraints that previously generated Equals/Unify constraints now generate LowerBound/UpperBound/Ordering constraints, and the meet operation for same-name concrete opaques now correctly computes the meet of their inner representations rather than requiring identical representations.

The snapshot test outputs for HIR lowering are updated to reflect that inference variables inside opaque wrappers now display with their opaque wrapper (e.g. ::graph::types::knowledge::entity::PropertyProvenance(?) instead of bare ?), which is a direct consequence of the solver now propagating through the opaque boundary.

🔍 What does this change?

  • Changed OpaqueType::is_subtype_of to use Variance::Covariant instead of Variance::Invariant.
  • Changed OpaqueType::collect_constraints to emit covariant constraints instead of invariant ones.
  • Fixed OpaqueType::is_top to always return false, since an opaque type is never the global top regardless of its inner representation.
  • Rewrote OpaqueType::meet to handle the concrete same-name case by computing the full lattice meet of the inner representations, rather than requiring structural equality.
  • Added a regression test opaque_covariant_subtype_through_union covering the W(A()) as W<A | B> pattern.
  • Added a unit test is_not_top verifying that W<Unknown> is not the global top.
  • Updated existing opaque type tests to reflect the new covariant constraint shapes (LowerBound/UpperBound/Ordering instead of Equals/Unify).
  • Updated HIR lowering snapshot outputs to reflect that inference variables inside opaque wrappers are now displayed with their nominal wrapper.
  • Updated the OpaqueType doc comment with a formal denotational semantics model justifying covariance.

🛡 What tests cover this?

  • New regression test opaque_covariant_subtype_through_union in the inference solver test suite.
  • New unit test is_not_top in the opaque type test suite.
  • Updated existing opaque type lattice and inference constraint tests.
  • Updated HIR lowering UI snapshot tests.

❓ How to test this?

  1. Run cargo test in libs/@local/hashql/core.
  2. Run the HIR lowering UI tests in libs/@local/hashql/hir.
  3. Confirm all tests pass and snapshot outputs match.

indietyp added 2 commits June 8, 2026 11:34
chore: add new dependency

chore: format

feat: error module

feat: introduce hashql_eval interner

chore: checkpoint

feat: checkpoint

feat: checkpoint

chore: remove old value module

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: checkpoint

chore: checkpoint

feat: move entity query into its own modul

fix: query request

feat: checkpoint (it compiles!)

feat: checkpoint

feat: checkpoint

feat: checkpoint

fix: issue around cached thunking

feat: covariance for opaque inners

fix: cfgattr serde

chore: remove graph module
Copilot AI review requested due to automatic review settings June 8, 2026 11:41
@cursor

cursor Bot commented Jun 8, 2026

Copy link
Copy Markdown

PR Summary

High Risk
Core type-system semantics for all opaque types change (subtyping, meet, inference, top), with broad test/snapshot fallout across HashQL checking.

Overview
HashQL opaque (nominal) types are now covariant in their inner type: same-name W<A> <: W<B> when A <: B, while different opaque names stay unrelated. Subtype checking, inference constraint collection, and docs move from invariant to covariant semantics (justified by immutable values).

is_top for opaques always returns false so W<Unknown> is only the top of that opaque family, not the global top—avoiding T | W<Unknown> collapsing to Unknown.

meet for same-name concrete opaques now meets inner representations through the lattice (e.g. W<Number> & W<Number|String>W<Number>) instead of requiring identical reps or yielding empty.

Tests add opaque_covariant_subtype_through_union (W(A()) as W<A|B> resolves the hole to A) and is_not_top; opaque tests expect ordering / bound constraints instead of unify / equals. HIR UI snapshots show inference holes inside opaque wrappers with full nominal paths (e.g. PropertyProvenance(?)).

Minor: #[inline] on a few Default impls; clippy allow in solver tests.

Reviewed by Cursor Bugbot for commit f4fbb1d. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Jun 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview, Comment Jun 9, 2026 7:28am
petrinaut Ready Ready Preview Jun 9, 2026 7:28am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview Jun 9, 2026 7:28am

@github-actions github-actions Bot added area/libs Relates to first-party libraries/crates/packages (area) type/eng > backend Owned by the @backend team area/tests New or updated tests labels Jun 8, 2026
@vercel vercel Bot temporarily deployed to Preview – petrinaut June 8, 2026 11:41 Inactive
@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.47368% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.16%. Comparing base (f2b4309) to head (f4fbb1d).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
libs/@local/hashql/core/src/type/kind/opaque.rs 89.47% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8835      +/-   ##
==========================================
+ Coverage   59.13%   59.16%   +0.02%     
==========================================
  Files        1346     1346              
  Lines      130077   130035      -42     
  Branches     5883     5884       +1     
==========================================
+ Hits        76923    76931       +8     
+ Misses      52248    52199      -49     
+ Partials      906      905       -1     
Flag Coverage Δ
apps.hash-ai-worker-ts 1.39% <ø> (ø)
apps.hash-api 0.00% <ø> (ø)
local.hash-backend-utils 2.81% <ø> (ø)
local.hash-graph-sdk 9.63% <ø> (ø)
local.hash-isomorphic-utils 0.00% <ø> (ø)
rust.hash-graph-api 2.51% <ø> (-0.01%) ⬇️
rust.hashql-ast 87.23% <ø> (ø)
rust.hashql-compiletest 28.26% <ø> (ø)
rust.hashql-core 79.42% <89.47%> (+0.13%) ⬆️
rust.hashql-eval 75.69% <ø> (ø)
rust.hashql-hir 89.06% <ø> (ø)
rust.hashql-mir 87.05% <ø> (ø)
rust.hashql-syntax-jexpr 94.06% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates HashQL’s type system so opaque types are treated as covariant in their inner representation (while remaining nominally distinct by opaque “family” name). It also fixes an incorrect “top” classification that could collapse unions across opaque boundaries, and updates solver/HIR snapshots and tests to reflect the new behavior.

Changes:

  • Make opaque subtyping/constraint collection covariant (propagate constraints through the opaque wrapper).
  • Fix OpaqueType::is_top so W<Unknown> is not considered the global top type, preserving nominal separation in unions.
  • Update lattice behavior/tests (notably meet for same-name concrete opaques) and refresh HIR lowering UI snapshots to reflect wrapped inference variables.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
libs/@local/hashql/hir/tests/ui/lower/specialization/filter-graph.stdout Updates expected HIR output to show inference variables wrapped by their opaque type.
libs/@local/hashql/hir/tests/ui/lower/specialization/collect-filter-graph.stdout Updates expected HIR output consistent with covariant opaque display changes.
libs/@local/hashql/hir/tests/ui/lower/specialization/collect-custom-collect.stderr Updates expected diagnostic rendering to include opaque wrappers around inference vars.
libs/@local/hashql/hir/tests/ui/lower/checking/minimal-graph.stdout Refreshes UI snapshot output for wrapped inference variables in minimal graph checking.
libs/@local/hashql/hir/tests/ui/lower/checking/filter-graph.stdout Refreshes UI snapshot output for wrapped inference variables in graph checking.
libs/@local/hashql/hir/tests/ui/lower/checking/collect-filter-graph.stdout Refreshes UI snapshot output for wrapped inference variables in collect+checking path.
libs/@local/hashql/core/src/type/visit.rs Adds #[inline] to Default impl for RecursiveVisitorGuard.
libs/@local/hashql/core/src/type/recursion.rs Adds #[inline] to Default impl for RecursionBoundary.
libs/@local/hashql/core/src/type/kind/tests/opaque.rs Updates and adds tests covering covariance, is_top behavior, and new constraint shapes.
libs/@local/hashql/core/src/type/kind/opaque.rs Implements covariant opaque subtype/constraints, corrects is_top, and updates meet semantics + docs.
libs/@local/hashql/core/src/type/inference/solver/tests.rs Adds regression test for covariant opaque subtyping through unions; adds a module-level clippy expectation.
libs/@local/hashql/core/src/type/inference/solver/mod.rs Adds #[inline] to Default impl for VariableConstraintSatisfiability.
libs/@local/hashql/core/src/type/inference/solver/graph.rs Adds #[inline] to Default impl for Edges.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codspeed-hq

codspeed-hq Bot commented Jun 8, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 19.34%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
✅ 79 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
pattern_match_constant 180 ns 150.8 ns +19.34%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing bm/be-582-hashql-make-opaque-types-covariant-in-their-inner (f4fbb1d) with main (232b539)

Open in CodSpeed

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Benchmark results

@rust/hash-graph-benches – Integrations

policy_resolution_large

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 2002 $$28.3 \mathrm{ms} \pm 203 \mathrm{μs}\left({\color{gray}2.53 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$3.43 \mathrm{ms} \pm 25.3 \mathrm{μs}\left({\color{gray}-2.762 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1001 $$13.4 \mathrm{ms} \pm 117 \mathrm{μs}\left({\color{red}5.49 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 3314 $$44.0 \mathrm{ms} \pm 365 \mathrm{μs}\left({\color{gray}1.91 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$14.2 \mathrm{ms} \pm 108 \mathrm{μs}\left({\color{lightgreen}-5.691 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 1526 $$24.8 \mathrm{ms} \pm 189 \mathrm{μs}\left({\color{gray}2.07 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 2078 $$29.4 \mathrm{ms} \pm 172 \mathrm{μs}\left({\color{gray}2.31 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.80 \mathrm{ms} \pm 26.1 \mathrm{μs}\left({\color{gray}-2.210 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 1033 $$14.2 \mathrm{ms} \pm 122 \mathrm{μs}\left({\color{gray}3.13 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_medium

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 102 $$3.86 \mathrm{ms} \pm 23.4 \mathrm{μs}\left({\color{gray}1.67 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$3.01 \mathrm{ms} \pm 21.0 \mathrm{μs}\left({\color{gray}1.34 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 51 $$3.42 \mathrm{ms} \pm 25.7 \mathrm{μs}\left({\color{gray}1.65 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 269 $$5.26 \mathrm{ms} \pm 29.9 \mathrm{μs}\left({\color{gray}1.88 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$3.58 \mathrm{ms} \pm 19.8 \mathrm{μs}\left({\color{gray}1.75 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 107 $$4.20 \mathrm{ms} \pm 29.8 \mathrm{μs}\left({\color{gray}1.14 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 133 $$4.47 \mathrm{ms} \pm 31.2 \mathrm{μs}\left({\color{gray}1.01 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.51 \mathrm{ms} \pm 26.6 \mathrm{μs}\left({\color{gray}0.254 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 63 $$4.12 \mathrm{ms} \pm 29.5 \mathrm{μs}\left({\color{gray}0.684 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_none

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 2 $$2.61 \mathrm{ms} \pm 15.8 \mathrm{μs}\left({\color{gray}0.114 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.49 \mathrm{ms} \pm 12.4 \mathrm{μs}\left({\color{gray}-0.366 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1 $$2.59 \mathrm{ms} \pm 16.8 \mathrm{μs}\left({\color{gray}1.31 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 8 $$2.88 \mathrm{ms} \pm 21.5 \mathrm{μs}\left({\color{gray}1.22 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.68 \mathrm{ms} \pm 18.9 \mathrm{μs}\left({\color{gray}1.03 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 3 $$2.83 \mathrm{ms} \pm 14.8 \mathrm{μs}\left({\color{gray}-0.762 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_small

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 52 $$3.05 \mathrm{ms} \pm 20.7 \mathrm{μs}\left({\color{gray}1.17 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.76 \mathrm{ms} \pm 18.9 \mathrm{μs}\left({\color{gray}0.225 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 25 $$2.99 \mathrm{ms} \pm 19.7 \mathrm{μs}\left({\color{gray}-0.504 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 94 $$3.46 \mathrm{ms} \pm 25.7 \mathrm{μs}\left({\color{gray}1.35 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$2.96 \mathrm{ms} \pm 16.8 \mathrm{μs}\left({\color{gray}0.542 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 26 $$3.30 \mathrm{ms} \pm 24.6 \mathrm{μs}\left({\color{gray}0.440 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 66 $$3.33 \mathrm{ms} \pm 17.6 \mathrm{μs}\left({\color{gray}-0.371 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.94 \mathrm{ms} \pm 16.7 \mathrm{μs}\left({\color{gray}1.01 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 29 $$3.35 \mathrm{ms} \pm 25.7 \mathrm{μs}\left({\color{gray}1.18 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_complete

Function Value Mean Flame graphs
entity_by_id;one_depth 1 entities $$55.8 \mathrm{ms} \pm 419 \mathrm{μs}\left({\color{gray}1.84 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 10 entities $$46.9 \mathrm{ms} \pm 224 \mathrm{μs}\left({\color{gray}0.671 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 25 entities $$50.6 \mathrm{ms} \pm 258 \mathrm{μs}\left({\color{gray}0.478 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 5 entities $$57.8 \mathrm{ms} \pm 1.37 \mathrm{ms}\left({\color{red}28.0 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 50 entities $$63.1 \mathrm{ms} \pm 444 \mathrm{μs}\left({\color{gray}0.706 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 1 entities $$62.7 \mathrm{ms} \pm 338 \mathrm{μs}\left({\color{gray}-0.422 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 10 entities $$56.7 \mathrm{ms} \pm 437 \mathrm{μs}\left({\color{gray}-1.632 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 25 entities $$105 \mathrm{ms} \pm 601 \mathrm{μs}\left({\color{gray}0.608 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 5 entities $$51.5 \mathrm{ms} \pm 2.38 \mathrm{ms}\left({\color{red}9.21 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 50 entities $$296 \mathrm{ms} \pm 962 \mathrm{μs}\left({\color{lightgreen}-8.304 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 1 entities $$19.8 \mathrm{ms} \pm 119 \mathrm{μs}\left({\color{gray}-1.468 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 10 entities $$20.2 \mathrm{ms} \pm 126 \mathrm{μs}\left({\color{gray}0.930 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 25 entities $$20.4 \mathrm{ms} \pm 129 \mathrm{μs}\left({\color{gray}0.098 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 5 entities $$19.6 \mathrm{ms} \pm 144 \mathrm{μs}\left({\color{gray}-0.197 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 50 entities $$25.3 \mathrm{ms} \pm 154 \mathrm{μs}\left({\color{gray}-0.070 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_linkless

Function Value Mean Flame graphs
entity_by_id 1 entities $$19.8 \mathrm{ms} \pm 126 \mathrm{μs}\left({\color{gray}1.33 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$19.5 \mathrm{ms} \pm 93.3 \mathrm{μs}\left({\color{gray}-0.079 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$19.8 \mathrm{ms} \pm 144 \mathrm{μs}\left({\color{gray}1.10 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1000 entities $$21.2 \mathrm{ms} \pm 126 \mathrm{μs}\left({\color{gray}3.19 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$27.1 \mathrm{ms} \pm 211 \mathrm{μs}\left({\color{gray}1.90 \mathrm{\%}}\right) $$ Flame Graph

representative_read_entity

Function Value Mean Flame graphs
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/block/v/1 $$36.0 \mathrm{ms} \pm 298 \mathrm{μs}\left({\color{gray}-0.245 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$35.4 \mathrm{ms} \pm 350 \mathrm{μs}\left({\color{gray}2.15 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 $$36.4 \mathrm{ms} \pm 369 \mathrm{μs}\left({\color{gray}-0.015 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$35.9 \mathrm{ms} \pm 294 \mathrm{μs}\left({\color{gray}1.25 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$36.5 \mathrm{ms} \pm 344 \mathrm{μs}\left({\color{gray}1.78 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$35.8 \mathrm{ms} \pm 340 \mathrm{μs}\left({\color{gray}-0.299 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$36.5 \mathrm{ms} \pm 348 \mathrm{μs}\left({\color{gray}-0.536 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$35.8 \mathrm{ms} \pm 382 \mathrm{μs}\left({\color{gray}1.00 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$36.8 \mathrm{ms} \pm 314 \mathrm{μs}\left({\color{gray}2.39 \mathrm{\%}}\right) $$ Flame Graph

representative_read_entity_type

Function Value Mean Flame graphs
get_entity_type_by_id Account ID: bf5a9ef5-dc3b-43cf-a291-6210c0321eba $$8.73 \mathrm{ms} \pm 45.3 \mathrm{μs}\left({\color{gray}-0.188 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
entity_by_property traversal_paths=0 0 $$95.0 \mathrm{ms} \pm 563 \mathrm{μs}\left({\color{gray}1.05 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=255 1,resolve_depths=inherit:1;values:255;properties:255;links:127;link_dests:126;type:true $$151 \mathrm{ms} \pm 771 \mathrm{μs}\left({\color{gray}0.188 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:0;link_dests:0;type:false $$102 \mathrm{ms} \pm 719 \mathrm{μs}\left({\color{gray}1.76 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:1;link_dests:0;type:true $$112 \mathrm{ms} \pm 618 \mathrm{μs}\left({\color{gray}-1.181 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:2;links:1;link_dests:0;type:true $$119 \mathrm{ms} \pm 686 \mathrm{μs}\left({\color{gray}0.321 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:2;properties:2;links:1;link_dests:0;type:true $$128 \mathrm{ms} \pm 748 \mathrm{μs}\left({\color{gray}-0.037 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=0 0 $$105 \mathrm{ms} \pm 632 \mathrm{μs}\left({\color{gray}1.10 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=255 1,resolve_depths=inherit:1;values:255;properties:255;links:127;link_dests:126;type:true $$135 \mathrm{ms} \pm 804 \mathrm{μs}\left({\color{gray}1.21 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:0;link_dests:0;type:false $$113 \mathrm{ms} \pm 736 \mathrm{μs}\left({\color{gray}1.93 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:1;link_dests:0;type:true $$121 \mathrm{ms} \pm 585 \mathrm{μs}\left({\color{gray}0.753 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:2;links:1;link_dests:0;type:true $$123 \mathrm{ms} \pm 566 \mathrm{μs}\left({\color{gray}0.575 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:2;properties:2;links:1;link_dests:0;type:true $$125 \mathrm{ms} \pm 750 \mathrm{μs}\left({\color{gray}1.93 \mathrm{\%}}\right) $$

scenarios

Function Value Mean Flame graphs
full_test query-limited $$166 \mathrm{ms} \pm 2.71 \mathrm{ms}\left({\color{red}12.8 \mathrm{\%}}\right) $$ Flame Graph
full_test query-unlimited $$154 \mathrm{ms} \pm 787 \mathrm{μs}\left({\color{gray}0.912 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-limited $$39.6 \mathrm{ms} \pm 282 \mathrm{μs}\left({\color{gray}-1.181 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-unlimited $$575 \mathrm{ms} \pm 1.62 \mathrm{ms}\left({\color{gray}2.54 \mathrm{\%}}\right) $$ Flame Graph

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/libs Relates to first-party libraries/crates/packages (area) area/tests New or updated tests type/eng > backend Owned by the @backend team

Development

Successfully merging this pull request may close these issues.

2 participants