Skip to content

BE-513: HashQL: Rework dynamic aggregate size estimation#8697

Open
indietyp wants to merge 4 commits intobm/be-512-hashql-switchint-allow-cross-backend-transitionsfrom
bm/be-513-hashql-size-estimation-aggregate-cardinality-is-wrong-for
Open

BE-513: HashQL: Rework dynamic aggregate size estimation#8697
indietyp wants to merge 4 commits intobm/be-512-hashql-switchint-allow-cross-backend-transitionsfrom
bm/be-513-hashql-size-estimation-aggregate-cardinality-is-wrong-for

Conversation

@indietyp
Copy link
Copy Markdown
Member

@indietyp indietyp commented May 4, 2026

🌟 What is the purpose of this PR?

The size estimation analysis previously treated all aggregate kinds (structs, tuples, lists, dicts, closures) identically — summing operand footprints and accumulating cardinality as if every aggregate were a flat collection. This was incorrect: a struct or tuple is a single composite value with cardinality 1, while a list or dict is a true collection whose cardinality equals its element count.

This PR introduces type-aware aggregate footprint evaluation. Structs and tuples now correctly report cardinality 1 with units equal to the sum of their fields' materialized sizes. Lists report per-element units (joined across elements) with cardinality equal to the element count. Dicts compute per-pair units (key + value combined) with cardinality equal to the pair count. Closures combine their function pointer and environment footprints into a single scalar value.

To support this, a materialize() method is introduced on Footprint that collapses a footprint's (units, cardinality) pair into a single total information estimate. This is needed when a value with its own cardinality (e.g. a list) is embedded as a field of a composite type — the field's contribution to the parent's units must account for the full information content of the nested value, not just its per-element size.

🔍 What does this change?

  • Replaces the single generic RValue::Aggregate handler in eval_rvalue with a dedicated eval_rvalue_aggregate method that dispatches on AggregateKind.
  • Struct/Tuple: sums the materialize()d footprints of all operands and sets cardinality to 1.
  • List: joins per-element materialized units and sets cardinality to the literal element count.
  • Dict: joins per-pair materialized units (key + value combined via saturating_mul_add) and sets cardinality to the pair count.
  • Closure: combines function pointer and environment footprints into a single scalar (cardinality 1).
  • Opaque: retains the previous behaviour of summing raw footprints.
  • Adds Footprint::materialize() which multiplies units by cardinality to produce a total information estimate, with case-specific handling for constant×constant (exact), affine units×constant cardinality (scale coefficients by cardinality upper bound), and affine×affine (element-wise coefficient multiplication as a linear under-approximation).
  • Adds Footprint::one(units) constructor for footprints with cardinality exactly 1.
  • Adds Estimate::saturating_coeff_mul for element-wise coefficient multiplication between two estimates.
  • Adds InformationRange::saturating_mul_cardinality for range-level multiplication of information by cardinality, saturating to unbounded on overflow.
  • Adds Eval::into_footprint as a consuming counterpart to Eval::as_ref.
  • Fixes the snapshot for struct_aggregate_sums_operands and tuple_aggregate_sums_operands, which previously reported cardinality 2 for a two-field struct/tuple; both now correctly report cardinality 1.

🛡 What tests cover this?

  • New integration tests: list_aggregate_per_element_units, dict_aggregate_per_pair_units, tuple_many_fields_cardinality_one, and struct_materializes_list_parameter, each with corresponding snapshot files.
  • New unit tests in footprint.rs covering all four materialize() branches: scalar identity, constant×constant, affine units×constant cardinality, constant units×affine cardinality, and both-affine same-parameter.
  • New unit tests in range.rs covering saturating_mul_cardinality: exact multiplication, identity by 1, empty inputs, unbounded cardinality, and overflow to unbounded.

❓ How to test this?

  1. Run cargo test -p hashql-mir and confirm all tests pass.
  2. Review the new and updated snapshots under libs/@local/hashql/mir/tests/ui/pass/size-estimation/ to verify the reported units and cardinality values match the expected semantics for each aggregate kind.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 4, 2026

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

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview, Comment May 4, 2026 3:33pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview May 4, 2026 3:33pm
petrinaut Skipped Skipped May 4, 2026 3:33pm

@vercel vercel Bot temporarily deployed to Preview – petrinaut May 4, 2026 14:23 Inactive
@cursor
Copy link
Copy Markdown

cursor Bot commented May 4, 2026

PR Summary

Medium Risk
Changes core size-estimation semantics for aggregates (units/cardinality computation and affine handling), which can affect downstream planning/optimization behavior, though it’s covered by expanded unit + snapshot tests.

Overview
Reworks dynamic size estimation for RValue::Aggregate to be aggregate-kind aware instead of treating all aggregates as flat collections: structs/tuples now return cardinality 1 with units equal to the sum of each field’s materialized size; lists return joined per-element units with cardinality = element count; dicts return joined per-pair (key+value) units with cardinality = pair count; closures combine fn ptr + env into a single scalar footprint; opaque aggregates keep the prior “sum raw footprints” behavior.

Adds Footprint::materialize() (and helpers like Footprint::one, Estimate::saturating_coeff_mul, InformationRange::saturating_mul_cardinality, and Eval::into_footprint) to correctly collapse nested (units, cardinality) into total information when embedding collections inside composites. Updates/extends tests and snapshots to lock in the corrected cardinality semantics and new list/dict/materialization behavior.

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

@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 May 4, 2026
Copy link
Copy Markdown
Member Author

indietyp commented May 4, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@indietyp indietyp force-pushed the bm/be-513-hashql-size-estimation-aggregate-cardinality-is-wrong-for branch from d52594c to ae2d3af Compare May 4, 2026 14:24
@indietyp indietyp force-pushed the bm/be-512-hashql-switchint-allow-cross-backend-transitions branch from fb7f8ba to 5eeec53 Compare May 4, 2026 14:24
@vercel vercel Bot temporarily deployed to Preview – petrinaut May 4, 2026 14:24 Inactive
@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented May 4, 2026

🤖 Augment PR Summary

Summary: Reworks HashQL MIR dynamic aggregate size estimation to be type-aware, fixing incorrect cardinality behavior that previously treated all aggregates like flat collections.

Changes:

  • Adds `eval_rvalue_aggregate()` to dispatch aggregate evaluation by `AggregateKind` instead of generic operand summation.
  • Struct/Tuple: materialize each field and sum into `units`, with `cardinality = 1`.
  • List: joins per-element materialized `units`, with `cardinality` set to the literal element count.
  • Dict: joins per-pair (key + value) materialized `units`, with `cardinality` set to the pair count.
  • Closure: combines function pointer and environment footprints into a single scalar footprint.
  • Introduces `Footprint::materialize()` (+ `Footprint::one`, `Eval::into_footprint`) to collapse `(units, cardinality)` into total information when embedding nested values.
  • Adds supporting math helpers (`Estimate::saturating_coeff_mul`, `InformationRange::saturating_mul_cardinality`) plus new/updated tests and snapshots for the new semantics.

Why: Ensures composite values (structs/tuples/closures) aren’t mis-modeled as collections, and nested collections contribute their full information content when used inside composites.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 4, 2026

Merging this PR will not alter performance

✅ 24 untouched benchmarks
⏩ 56 skipped benchmarks1


Comparing bm/be-513-hashql-size-estimation-aggregate-cardinality-is-wrong-for (598d416) with bm/be-512-hashql-switchint-allow-cross-backend-transitions (5eeec53)

Open in CodSpeed

Footnotes

  1. 56 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

❌ Patch coverage is 91.07143% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.31%. Comparing base (5eeec53) to head (598d416).

Files with missing lines Patch % Lines
...l/mir/src/pass/analysis/size_estimation/dynamic.rs 73.49% 22 Missing ⚠️
...mir/src/pass/analysis/size_estimation/footprint.rs 92.15% 4 Missing and 4 partials ⚠️
Additional details and impacted files
@@                                      Coverage Diff                                       @@
##           bm/be-512-hashql-switchint-allow-cross-backend-transitions    #8697      +/-   ##
==============================================================================================
+ Coverage                                                       66.19%   66.31%   +0.11%     
==============================================================================================
  Files                                                             932      932              
  Lines                                                           84621    84949     +328     
  Branches                                                         4461     4468       +7     
==============================================================================================
+ Hits                                                            56017    56331     +314     
- Misses                                                          28056    28067      +11     
- Partials                                                          548      551       +3     
Flag Coverage Δ
apps.hash-ai-worker-ts 1.41% <ø> (ø)
apps.hash-api 0.00% <ø> (ø)
local.hash-backend-utils 0.00% <ø> (ø)
local.hash-graph-sdk 9.63% <ø> (ø)
local.hash-isomorphic-utils 0.00% <ø> (ø)
rust.hash-graph-api 2.52% <ø> (ø)
rust.hashql-compiletest 28.26% <ø> (ø)
rust.hashql-eval 79.70% <ø> (ø)
rust.hashql-mir 91.88% <91.07%> (+0.04%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 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.

@vercel vercel Bot temporarily deployed to Preview – petrinaut May 4, 2026 14:42 Inactive
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 598d416. Configure here.

*coefficient = coefficient.saturating_mul(scale);
}

Estimate::Affine(result)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Empty cardinality treated as unbounded in materialize

Low Severity

In materialize(), the Affine × Constant arm calls cardinality.inclusive_max(), which returns None for both Cardinality::empty() (max = Excluded(0), since 0u32.checked_sub(1) is None) and Cardinality::full() (max = Unbounded). When None is returned, the code assumes unbounded cardinality and returns InformationRange::full(). This is wrong for empty cardinality — the result should be empty/zero, not full. The Constant × Constant arm handles this correctly because saturating_mul_cardinality explicitly checks is_empty() first. A missing cardinality.is_empty() guard before the inclusive_max() check causes the inconsistency.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 598d416. Configure here.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

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 $$25.9 \mathrm{ms} \pm 137 \mathrm{μs}\left({\color{gray}1.37 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$3.55 \mathrm{ms} \pm 20.0 \mathrm{μs}\left({\color{gray}1.32 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1001 $$12.5 \mathrm{ms} \pm 92.0 \mathrm{μs}\left({\color{gray}2.80 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 3314 $$42.6 \mathrm{ms} \pm 322 \mathrm{μs}\left({\color{gray}-0.602 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$15.4 \mathrm{ms} \pm 106 \mathrm{μs}\left({\color{gray}1.58 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 1526 $$23.6 \mathrm{ms} \pm 210 \mathrm{μs}\left({\color{gray}0.861 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 2078 $$26.3 \mathrm{ms} \pm 185 \mathrm{μs}\left({\color{gray}0.051 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.88 \mathrm{ms} \pm 22.3 \mathrm{μs}\left({\color{gray}1.48 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 1033 $$13.1 \mathrm{ms} \pm 77.2 \mathrm{μs}\left({\color{gray}-0.530 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_medium

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 102 $$3.70 \mathrm{ms} \pm 19.5 \mathrm{μs}\left({\color{gray}0.485 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$3.00 \mathrm{ms} \pm 17.1 \mathrm{μs}\left({\color{gray}0.759 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 51 $$3.32 \mathrm{ms} \pm 16.9 \mathrm{μs}\left({\color{gray}-0.491 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 269 $$5.11 \mathrm{ms} \pm 34.9 \mathrm{μs}\left({\color{gray}1.35 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$3.50 \mathrm{ms} \pm 17.7 \mathrm{μs}\left({\color{gray}-1.393 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 107 $$4.07 \mathrm{ms} \pm 29.7 \mathrm{μs}\left({\color{gray}0.508 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 133 $$4.30 \mathrm{ms} \pm 25.6 \mathrm{μs}\left({\color{gray}0.266 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.42 \mathrm{ms} \pm 15.3 \mathrm{μs}\left({\color{gray}-0.858 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 63 $$4.01 \mathrm{ms} \pm 23.9 \mathrm{μs}\left({\color{gray}-0.184 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_none

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 2 $$2.65 \mathrm{ms} \pm 11.2 \mathrm{μs}\left({\color{gray}2.85 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.52 \mathrm{ms} \pm 15.0 \mathrm{μs}\left({\color{gray}0.018 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1 $$2.66 \mathrm{ms} \pm 13.0 \mathrm{μs}\left({\color{gray}3.79 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 8 $$2.93 \mathrm{ms} \pm 13.2 \mathrm{μs}\left({\color{gray}2.95 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.71 \mathrm{ms} \pm 13.0 \mathrm{μs}\left({\color{gray}3.41 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 3 $$2.93 \mathrm{ms} \pm 14.0 \mathrm{μs}\left({\color{gray}3.45 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_small

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 52 $$3.04 \mathrm{ms} \pm 19.5 \mathrm{μs}\left({\color{gray}2.41 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.71 \mathrm{ms} \pm 11.9 \mathrm{μs}\left({\color{gray}1.11 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 25 $$2.97 \mathrm{ms} \pm 17.8 \mathrm{μs}\left({\color{gray}-0.175 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 94 $$3.37 \mathrm{ms} \pm 20.0 \mathrm{μs}\left({\color{gray}1.01 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$3.00 \mathrm{ms} \pm 20.6 \mathrm{μs}\left({\color{gray}1.56 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 26 $$3.26 \mathrm{ms} \pm 16.8 \mathrm{μs}\left({\color{gray}0.775 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 66 $$3.28 \mathrm{ms} \pm 15.8 \mathrm{μs}\left({\color{gray}-0.266 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.96 \mathrm{ms} \pm 17.2 \mathrm{μs}\left({\color{gray}2.44 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 29 $$3.28 \mathrm{ms} \pm 17.9 \mathrm{μs}\left({\color{gray}-0.217 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_complete

Function Value Mean Flame graphs
entity_by_id;one_depth 1 entities $$54.3 \mathrm{ms} \pm 372 \mathrm{μs}\left({\color{gray}-0.338 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 10 entities $$45.9 \mathrm{ms} \pm 210 \mathrm{μs}\left({\color{gray}-0.261 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 25 entities $$50.8 \mathrm{ms} \pm 215 \mathrm{μs}\left({\color{gray}1.35 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 5 entities $$49.1 \mathrm{ms} \pm 1.06 \mathrm{ms}\left({\color{red}11.4 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 50 entities $$62.5 \mathrm{ms} \pm 329 \mathrm{μs}\left({\color{gray}-0.253 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 1 entities $$61.5 \mathrm{ms} \pm 299 \mathrm{μs}\left({\color{gray}-0.306 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 10 entities $$55.6 \mathrm{ms} \pm 253 \mathrm{μs}\left({\color{gray}-0.289 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 25 entities $$102 \mathrm{ms} \pm 459 \mathrm{μs}\left({\color{gray}0.893 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 5 entities $$46.4 \mathrm{ms} \pm 280 \mathrm{μs}\left({\color{gray}0.465 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 50 entities $$268 \mathrm{ms} \pm 784 \mathrm{μs}\left({\color{lightgreen}-6.953 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 1 entities $$19.4 \mathrm{ms} \pm 92.2 \mathrm{μs}\left({\color{gray}1.19 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 10 entities $$19.9 \mathrm{ms} \pm 101 \mathrm{μs}\left({\color{gray}-0.012 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 25 entities $$20.3 \mathrm{ms} \pm 99.9 \mathrm{μs}\left({\color{gray}-0.191 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 5 entities $$19.3 \mathrm{ms} \pm 90.7 \mathrm{μs}\left({\color{gray}0.313 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 50 entities $$25.4 \mathrm{ms} \pm 126 \mathrm{μs}\left({\color{gray}0.955 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_linkless

Function Value Mean Flame graphs
entity_by_id 1 entities $$19.3 \mathrm{ms} \pm 91.8 \mathrm{μs}\left({\color{gray}1.25 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$19.1 \mathrm{ms} \pm 86.7 \mathrm{μs}\left({\color{gray}-0.857 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$18.5 \mathrm{ms} \pm 87.8 \mathrm{μs}\left({\color{lightgreen}-5.355 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1000 entities $$20.0 \mathrm{ms} \pm 92.9 \mathrm{μs}\left({\color{gray}-3.271 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$26.7 \mathrm{ms} \pm 185 \mathrm{μs}\left({\color{gray}0.293 \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 $$33.7 \mathrm{ms} \pm 266 \mathrm{μs}\left({\color{gray}1.60 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$34.9 \mathrm{ms} \pm 240 \mathrm{μs}\left({\color{gray}3.47 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 $$33.7 \mathrm{ms} \pm 270 \mathrm{μs}\left({\color{gray}-0.437 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$34.5 \mathrm{ms} \pm 281 \mathrm{μs}\left({\color{gray}-0.176 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$33.9 \mathrm{ms} \pm 254 \mathrm{μs}\left({\color{gray}0.822 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$34.6 \mathrm{ms} \pm 252 \mathrm{μs}\left({\color{gray}1.90 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$33.9 \mathrm{ms} \pm 261 \mathrm{μs}\left({\color{gray}-1.389 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$34.2 \mathrm{ms} \pm 279 \mathrm{μs}\left({\color{gray}2.08 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$34.4 \mathrm{ms} \pm 258 \mathrm{μs}\left({\color{gray}4.07 \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.44 \mathrm{ms} \pm 36.8 \mathrm{μs}\left({\color{gray}-0.052 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
entity_by_property traversal_paths=0 0 $$89.9 \mathrm{ms} \pm 440 \mathrm{μs}\left({\color{gray}0.707 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=255 1,resolve_depths=inherit:1;values:255;properties:255;links:127;link_dests:126;type:true $$144 \mathrm{ms} \pm 525 \mathrm{μs}\left({\color{gray}0.522 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:0;link_dests:0;type:false $$96.3 \mathrm{ms} \pm 389 \mathrm{μs}\left({\color{gray}-0.095 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:1;link_dests:0;type:true $$107 \mathrm{ms} \pm 402 \mathrm{μs}\left({\color{gray}0.158 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:2;links:1;link_dests:0;type:true $$114 \mathrm{ms} \pm 434 \mathrm{μs}\left({\color{gray}-0.003 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:2;properties:2;links:1;link_dests:0;type:true $$123 \mathrm{ms} \pm 494 \mathrm{μs}\left({\color{gray}-0.475 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=0 0 $$101 \mathrm{ms} \pm 315 \mathrm{μs}\left({\color{gray}-0.236 \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 $$133 \mathrm{ms} \pm 414 \mathrm{μs}\left({\color{gray}1.90 \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 $$108 \mathrm{ms} \pm 386 \mathrm{μs}\left({\color{gray}0.501 \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 $$119 \mathrm{ms} \pm 447 \mathrm{μs}\left({\color{gray}0.338 \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 $$121 \mathrm{ms} \pm 545 \mathrm{μs}\left({\color{gray}1.65 \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 $$120 \mathrm{ms} \pm 469 \mathrm{μs}\left({\color{gray}1.10 \mathrm{\%}}\right) $$

scenarios

Function Value Mean Flame graphs
full_test query-limited $$190 \mathrm{ms} \pm 596 \mathrm{μs}\left({\color{gray}-0.608 \mathrm{\%}}\right) $$ Flame Graph
full_test query-unlimited $$173 \mathrm{ms} \pm 2.57 \mathrm{ms}\left({\color{lightgreen}-5.285 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-limited $$40.8 \mathrm{ms} \pm 162 \mathrm{μs}\left({\color{gray}0.239 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-unlimited $$541 \mathrm{ms} \pm 1.04 \mathrm{ms}\left({\color{gray}-3.066 \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