Skip to content

BE-581, BE-589: HashQL: Introduce pass::lower/pass::place pipeline facades and fix cached constructor closure bug#8838

Merged
indietyp merged 6 commits into
mainfrom
bm/be-581-hashql-cached-constructor-produces-bare-fnptr-instead-of
Jun 30, 2026
Merged

BE-581, BE-589: HashQL: Introduce pass::lower/pass::place pipeline facades and fix cached constructor closure bug#8838
indietyp merged 6 commits into
mainfrom
bm/be-581-hashql-cached-constructor-produces-bare-fnptr-instead-of

Conversation

@indietyp

@indietyp indietyp commented Jun 8, 2026

Copy link
Copy Markdown
Member

🌟 What is the purpose of this PR?

This PR introduces two high-level pipeline functions, pass::lower and pass::place, that encapsulate the MIR lowering and execution placement pipelines respectively. Previously, callers had to manually orchestrate individual passes, manage scratch allocator resets, and collect diagnostics themselves. These new functions consolidate that logic into a single call site, making the pipeline easier to use correctly and harder to misuse.

Additionally, this PR fixes a bug in the MIR reifier where a cached constructor reference was emitted as a bare FnPtr on cache hit, while the calling convention requires a fat pointer (closure aggregate). The fix ensures both the first and subsequent uses of a constructor emit a closure(FnPtr, ()) aggregate. This resolves the previously failing access-struct-through-opaque interpreter test, which now passes.

The ReifyContext is also extended with a scratch allocator parameter so that the reifier can use scratch memory for temporary allocations (e.g., the Thunks vector), avoiding unnecessary heap allocations.

🔍 What does this change?

  • Introduces pass::lower to run the pre-inline, inline, and post-inline transform passes as a single operation, handling scratch resets and diagnostic collection internally.
  • Introduces pass::place to run size estimation and execution analysis as a single operation, returning the ExecutionAnalysisResidual on success.
  • Adds LowerConfig as a configuration struct for the lowering pipeline, wrapping InlineConfig.
  • Extends ReifyContext with a generic scratch allocator field (S: Allocator) so the reifier can allocate temporary structures (e.g., Thunks::defs) from scratch memory rather than the heap.
  • Fixes the constructor caching bug in rvalue.rs where the cache-hit path returned a bare FnPtr instead of a closure aggregate, causing downstream interpreter failures.
  • Updates mir_reify in the compiletest suite to return the Scratch allocator alongside the root and bodies, so callers that need scratch memory don't have to create a new one.
  • Adds Debug implementations for LinkedGraph, IslandGraph, and ExecutionAnalysisResidual that do not require the allocator type parameter to implement Debug.
  • Adds a regression test (ctor-cached-closure) covering the constructor caching fix.
  • Updates the access-struct-through-opaque test from run: fail to run: pass now that the underlying bug is resolved.

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • does not modify any publishable blocks or libraries, or modifications do not need publishing

📜 Does this require a change to the docs?

The changes in this PR:

  • are internal and do not require a docs change

🕸️ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph

🛡 What tests cover this?

  • New ctor-cached-closure reify UI test covering the constructor caching regression.
  • Updated access-struct-through-opaque interpreter UI test, now expected to pass with correct output.
  • Existing MIR pass and reify UI tests continue to pass with the refactored pipeline.

❓ How to test this?

  1. Run the MIR compiletest suite.
  2. Confirm access-struct-through-opaque passes and produces the expected Opaque(Outer { x: A, y: A }) output.
  3. Confirm ctor-cached-closure passes and produces the expected MIR with closure(FnPtr, ()) on both constructor uses.

indietyp added 2 commits June 8, 2026 12:23
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

Medium Risk
Touches core MIR pipeline and reification calling conventions; the ctor fix changes generated MIR but is covered by UI tests.

Overview
Adds pass::lower and pass::place as single entry points for MIR optimization (pre-inline → inline → post-inline) and execution placement (size estimation → execution analysis), including scratch resets and diagnostic Status handling. The compiletest Pipeline now calls these instead of wiring individual passes.

ReifyContext gains a scratch allocator; HIR→MIR reification uses it for temporary structures (e.g. thunk maps), and mir_reify returns that Scratch for downstream suites.

Fixes MIR reification when a type constructor is reused from cache: the cache-hit path now emits a closure(FnPtr, ()) aggregate like the miss path, instead of a bare FnPtr. That unblocks interpreting struct access through opaque newtypes (access-struct-through-opaque passes; new ctor-cached-closure UI test).

Also adds targeted Debug for LinkedGraph, IslandGraph, and ExecutionAnalysisResidual without requiring allocator Debug, plus minor #[inline] on small Default impls.

Reviewed by Cursor Bugbot for commit 78a2784. 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 30, 2026 10:05am
petrinaut Ready Ready Preview Jun 30, 2026 10:05am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview Jun 30, 2026 10:05am

indietyp commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 14.11765% with 73 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.53%. Comparing base (b8971f3) to head (78a2784).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
libs/@local/hashql/mir/src/pass/mod.rs 0.00% 44 Missing ⚠️
libs/@local/hashql/compiletest/src/pipeline.rs 0.00% 10 Missing ⚠️
.../hashql/mir/src/pass/execution/island/graph/mod.rs 0.00% 7 Missing ⚠️
libs/@local/hashql/core/src/graph/linked.rs 0.00% 6 Missing ⚠️
libs/@local/hashql/mir/src/pass/execution/mod.rs 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8838      +/-   ##
==========================================
- Coverage   59.57%   59.53%   -0.04%     
==========================================
  Files        1366     1366              
  Lines      132760   132808      +48     
  Branches     6045     6045              
==========================================
- Hits        79094    79073      -21     
- Misses      52732    52798      +66     
- Partials      934      937       +3     
Flag Coverage Δ
apps.hash-ai-worker-ts 1.39% <ø> (ø)
apps.hash-api 6.39% <ø> (ø)
local.hash-backend-utils 2.81% <ø> (ø)
local.hash-graph-sdk 10.00% <ø> (ø)
local.hash-isomorphic-utils 0.18% <ø> (ø)
rust.hash-graph-api 2.49% <ø> (ø)
rust.hashql-ast 87.23% <ø> (ø)
rust.hashql-compiletest 28.40% <0.00%> (+0.15%) ⬆️
rust.hashql-core 79.58% <0.00%> (-0.03%) ⬇️
rust.hashql-eval 75.23% <ø> (ø)
rust.hashql-hir 89.06% <ø> (ø)
rust.hashql-mir 88.04% <17.39%> (-0.41%) ⬇️
rust.hashql-syntax-jexpr 94.04% <ø> (ø)

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.

@indietyp indietyp changed the title BE-581: HashQL: Introduce pass::lower/pass::place pipeline facades and fix cached constructor closure bug BE-581, BE-589: HashQL: Introduce pass::lower/pass::place pipeline facades and fix cached constructor closure bug Jun 8, 2026

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 refactors HashQL’s MIR pipeline API by introducing facade functions for lowering and execution placement, while also fixing a MIR reification bug where cached constructor references were emitted with the wrong calling convention representation (thin FnPtr vs closure aggregate fat pointer). It updates the compiletest harness and UI tests to cover the regression and to reflect the corrected interpreter behavior.

Changes:

  • Add pass::lower and pass::place pipeline facades (plus LowerConfig) to centralize scratch resets and diagnostic draining.
  • Fix constructor caching in MIR reification so both first-use and cache-hit paths emit closure(FnPtr, ()) aggregates.
  • Thread scratch allocator support through reification/compiletest utilities and add/adjust UI regression tests.

Reviewed changes

Copilot reviewed 38 out of 38 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
libs/@local/hashql/mir/tests/ui/reify/ctor-cached-closure.stdout New expected MIR output asserting cached ctor uses emit closure(FnPtr, ()).
libs/@local/hashql/mir/tests/ui/reify/ctor-cached-closure.jsonc New UI test input for cached-constructor closure aggregate regression.
libs/@local/hashql/mir/tests/ui/interpret/access-struct-through-opaque.stdout New passing interpreter output snapshot for opaque struct access.
libs/@local/hashql/mir/tests/ui/interpret/access-struct-through-opaque.stderr Removes prior ICE stderr expectations now that the bug is fixed.
libs/@local/hashql/mir/tests/ui/interpret/access-struct-through-opaque.jsonc Flips the test directive from run: fail to run: pass.
libs/@local/hashql/mir/tests/ui/interpret/access-struct-through-opaque.aux.mir Updates auxiliary MIR to reflect closure aggregate emission and downstream simplifications.
libs/@local/hashql/mir/src/reify/transform.rs Updates Reifier impl generics to support allocator-parametrized context.
libs/@local/hashql/mir/src/reify/terminator.rs Updates Reifier impl generics to match new allocator parameters.
libs/@local/hashql/mir/src/reify/rvalue.rs Fixes ctor caching path to always build a closure aggregate (fat pointer).
libs/@local/hashql/mir/src/reify/mod.rs Extends ReifyContext with scratch allocator and threads allocator generics through reifier state.
libs/@local/hashql/mir/src/reify/current.rs Adds #[inline] on small From impls.
libs/@local/hashql/mir/src/reify/atom.rs Updates Reifier impl generics to match new allocator parameters.
libs/@local/hashql/mir/src/pass/transform/ssa_repair/mod.rs Adds #[inline] on Default impl.
libs/@local/hashql/mir/src/pass/transform/inst_simplify/mod.rs Adds #[inline] on Default impl.
libs/@local/hashql/mir/src/pass/transform/forward_substitution.rs Adds #[inline] on Default impl.
libs/@local/hashql/mir/src/pass/transform/dse/mod.rs Adds #[inline] on Default impl.
libs/@local/hashql/mir/src/pass/transform/copy_propagation/mod.rs Adds #[inline] on Default impl.
libs/@local/hashql/mir/src/pass/transform/cfg_simplify/mod.rs Adds #[inline] on Default impl.
libs/@local/hashql/mir/src/pass/transform/canonicalization.rs Adds #[inline] on Default impl for config.
libs/@local/hashql/mir/src/pass/mod.rs Introduces LowerConfig, pass::lower, and pass::place facade functions.
libs/@local/hashql/mir/src/pass/execution/traversal/mod.rs Adds #[inline] on From impl.
libs/@local/hashql/mir/src/pass/execution/terminator_placement/mod.rs Adds #[inline] on Default impl.
libs/@local/hashql/mir/src/pass/execution/splitting/mod.rs Adds #[inline] on Default impl.
libs/@local/hashql/mir/src/pass/execution/mod.rs Adds allocator-agnostic Debug for ExecutionAnalysisResidual.
libs/@local/hashql/mir/src/pass/execution/island/mod.rs Adds #[inline] and Default-related tweaks.
libs/@local/hashql/mir/src/pass/execution/island/graph/mod.rs Adds allocator-agnostic Debug for IslandGraph.
libs/@local/hashql/mir/src/pass/execution/cost/mod.rs Adds #[inline] on From impl.
libs/@local/hashql/mir/src/pass/analysis/data_dependency/mod.rs Adds #[inline] on Default impl.
libs/@local/hashql/mir/src/interpret/error.rs Updates diagnostic alias documentation to match Critical default.
libs/@local/hashql/mir/src/body/operand.rs Adds #[inline] on small From impls.
libs/@local/hashql/eval/src/orchestrator/error.rs Updates diagnostic alias documentation to match Critical default.
libs/@local/hashql/core/src/graph/linked.rs Adds allocator-agnostic Debug for LinkedGraph (removes derived Debug).
libs/@local/hashql/compiletest/src/suite/mir_reify.rs Returns Scratch from mir_reify and passes scratch into ReifyContext.
libs/@local/hashql/compiletest/src/suite/mir_pass_transform_pre_inline.rs Updates for new mir_reify return shape.
libs/@local/hashql/compiletest/src/suite/mir_pass_transform_cfg_simplify.rs Reuses Scratch returned by mir_reify instead of creating a new one.
libs/@local/hashql/compiletest/src/suite/mir_pass_analysis_data_dependency.rs Updates for new mir_reify return shape.
libs/@local/hashql/compiletest/src/suite/eval_postgres.rs Minor fix to use heap consistently when passing allocator to eval context.
libs/@local/hashql/compiletest/src/pipeline.rs Switches orchestration to use pass::lower / pass::place facades and threads scratch into reify.

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

Comment thread libs/@local/hashql/compiletest/src/suite/mir_reify.rs
@codspeed-hq

codspeed-hq Bot commented Jun 8, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 11.56%

❌ 3 (👁 3) regressed benchmarks
✅ 77 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
👁 complex 16.2 µs 18.1 µs -10.82%
👁 diamond 10.9 µs 12.3 µs -11.47%
👁 linear 6.8 µs 7.8 µs -12.4%

Comparing bm/be-581-hashql-cached-constructor-produces-bare-fnptr-instead-of (78a2784) with main (b8971f3)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (a162311) during the generation of this report, so b8971f3 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@indietyp indietyp force-pushed the bm/be-581-hashql-cached-constructor-produces-bare-fnptr-instead-of branch from 74f8c73 to a203514 Compare June 8, 2026 11:55
Copilot AI review requested due to automatic review settings June 22, 2026 10:51
@indietyp indietyp force-pushed the bm/be-585-hashql-split-mir-interpret-diagnostic-api branch from 4097263 to b485279 Compare June 22, 2026 10:51
@indietyp indietyp force-pushed the bm/be-581-hashql-cached-constructor-produces-bare-fnptr-instead-of branch from 79c6226 to 610b509 Compare June 22, 2026 10:51

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

Copilot reviewed 36 out of 36 changed files in this pull request and generated 1 comment.

Comment thread libs/@local/hashql/mir/src/reify/mod.rs

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

Copilot reviewed 36 out of 36 changed files in this pull request and generated 2 comments.

Comment thread libs/@local/hashql/mir/src/reify/mod.rs
Comment thread libs/@local/hashql/compiletest/src/pipeline.rs
@vercel vercel Bot temporarily deployed to Preview – petrinaut June 23, 2026 09:52 Inactive
Base automatically changed from bm/be-585-hashql-split-mir-interpret-diagnostic-api to main June 24, 2026 09:37
Copilot AI review requested due to automatic review settings June 30, 2026 09:56
@indietyp indietyp force-pushed the bm/be-581-hashql-cached-constructor-produces-bare-fnptr-instead-of branch from cb9d12c to 78a2784 Compare June 30, 2026 09:56

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

Copilot reviewed 36 out of 36 changed files in this pull request and generated 1 comment.

Comment thread libs/@local/hashql/mir/src/reify/mod.rs

@thehabbos007 thehabbos007 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.

Nice!

@github-actions

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 $$27.9 \mathrm{ms} \pm 221 \mathrm{μs}\left({\color{gray}-0.357 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$3.43 \mathrm{ms} \pm 17.2 \mathrm{μs}\left({\color{gray}-0.232 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1002 $$12.9 \mathrm{ms} \pm 133 \mathrm{μs}\left({\color{gray}1.35 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 3314 $$44.4 \mathrm{ms} \pm 344 \mathrm{μs}\left({\color{gray}0.496 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$14.6 \mathrm{ms} \pm 153 \mathrm{μs}\left({\color{gray}-1.274 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 1527 $$24.8 \mathrm{ms} \pm 185 \mathrm{μs}\left({\color{gray}-0.154 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 2078 $$28.8 \mathrm{ms} \pm 212 \mathrm{μs}\left({\color{gray}-1.417 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.83 \mathrm{ms} \pm 32.4 \mathrm{μs}\left({\color{gray}-1.309 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 1033 $$14.3 \mathrm{ms} \pm 110 \mathrm{μs}\left({\color{gray}0.507 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_medium

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 102 $$3.85 \mathrm{ms} \pm 21.6 \mathrm{μs}\left({\color{gray}1.04 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$3.04 \mathrm{ms} \pm 18.2 \mathrm{μs}\left({\color{gray}0.627 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 52 $$3.42 \mathrm{ms} \pm 23.0 \mathrm{μs}\left({\color{gray}0.953 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 269 $$5.22 \mathrm{ms} \pm 32.2 \mathrm{μs}\left({\color{gray}-0.194 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$3.54 \mathrm{ms} \pm 17.6 \mathrm{μs}\left({\color{gray}-0.959 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 108 $$4.19 \mathrm{ms} \pm 26.4 \mathrm{μs}\left({\color{gray}0.535 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 133 $$4.51 \mathrm{ms} \pm 36.5 \mathrm{μs}\left({\color{gray}0.656 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.52 \mathrm{ms} \pm 29.0 \mathrm{μs}\left({\color{gray}1.24 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 63 $$4.14 \mathrm{ms} \pm 30.6 \mathrm{μs}\left({\color{gray}0.780 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_none

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 2 $$2.72 \mathrm{ms} \pm 18.6 \mathrm{μs}\left({\color{gray}0.652 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.56 \mathrm{ms} \pm 15.6 \mathrm{μs}\left({\color{gray}-0.711 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 2 $$2.70 \mathrm{ms} \pm 20.2 \mathrm{μs}\left({\color{gray}-0.632 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 8 $$2.98 \mathrm{ms} \pm 16.2 \mathrm{μs}\left({\color{gray}0.391 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.79 \mathrm{ms} \pm 22.6 \mathrm{μs}\left({\color{gray}1.81 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 3 $$2.97 \mathrm{ms} \pm 19.0 \mathrm{μs}\left({\color{gray}0.142 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_small

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 52 $$3.11 \mathrm{ms} \pm 20.6 \mathrm{μs}\left({\color{gray}1.09 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.76 \mathrm{ms} \pm 14.1 \mathrm{μs}\left({\color{gray}-0.314 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 26 $$3.04 \mathrm{ms} \pm 18.8 \mathrm{μs}\left({\color{gray}3.45 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 94 $$3.48 \mathrm{ms} \pm 22.5 \mathrm{μs}\left({\color{gray}0.269 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$2.99 \mathrm{ms} \pm 15.0 \mathrm{μs}\left({\color{gray}-0.526 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 27 $$3.33 \mathrm{ms} \pm 18.6 \mathrm{μs}\left({\color{gray}1.77 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 66 $$3.43 \mathrm{ms} \pm 21.4 \mathrm{μs}\left({\color{gray}1.22 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.00 \mathrm{ms} \pm 19.4 \mathrm{μs}\left({\color{gray}0.340 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 29 $$3.39 \mathrm{ms} \pm 25.0 \mathrm{μs}\left({\color{gray}3.44 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_complete

Function Value Mean Flame graphs
entity_by_id;one_depth 1 entities $$42.2 \mathrm{ms} \pm 206 \mathrm{μs}\left({\color{gray}0.175 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 10 entities $$32.6 \mathrm{ms} \pm 184 \mathrm{μs}\left({\color{gray}-2.616 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 25 entities $$35.5 \mathrm{ms} \pm 200 \mathrm{μs}\left({\color{gray}0.743 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 5 entities $$32.7 \mathrm{ms} \pm 331 \mathrm{μs}\left({\color{lightgreen}-8.364 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 50 entities $$42.5 \mathrm{ms} \pm 251 \mathrm{μs}\left({\color{gray}1.78 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 1 entities $$49.6 \mathrm{ms} \pm 321 \mathrm{μs}\left({\color{gray}0.527 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 10 entities $$40.0 \mathrm{ms} \pm 221 \mathrm{μs}\left({\color{gray}-2.013 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 25 entities $$91.3 \mathrm{ms} \pm 544 \mathrm{μs}\left({\color{gray}-2.184 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 5 entities $$33.2 \mathrm{ms} \pm 228 \mathrm{μs}\left({\color{lightgreen}-33.534 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 50 entities $$305 \mathrm{ms} \pm 1.15 \mathrm{ms}\left({\color{red}6.82 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 1 entities $$10.6 \mathrm{ms} \pm 70.9 \mathrm{μs}\left({\color{gray}0.073 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 10 entities $$10.8 \mathrm{ms} \pm 67.1 \mathrm{μs}\left({\color{gray}-2.839 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 25 entities $$10.8 \mathrm{ms} \pm 87.1 \mathrm{μs}\left({\color{gray}-0.652 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 5 entities $$10.4 \mathrm{ms} \pm 57.4 \mathrm{μs}\left({\color{gray}-3.042 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 50 entities $$10.7 \mathrm{ms} \pm 72.7 \mathrm{μs}\left({\color{gray}-2.017 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_linkless

Function Value Mean Flame graphs
entity_by_id 1 entities $$10.6 \mathrm{ms} \pm 74.1 \mathrm{μs}\left({\color{gray}-1.895 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$10.6 \mathrm{ms} \pm 75.2 \mathrm{μs}\left({\color{gray}-1.333 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$10.6 \mathrm{ms} \pm 65.2 \mathrm{μs}\left({\color{gray}-0.317 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1000 entities $$10.7 \mathrm{ms} \pm 62.1 \mathrm{μs}\left({\color{gray}0.570 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$10.8 \mathrm{ms} \pm 63.9 \mathrm{μs}\left({\color{gray}-1.636 \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 $$11.1 \mathrm{ms} \pm 62.8 \mathrm{μs}\left({\color{gray}0.399 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$11.1 \mathrm{ms} \pm 87.1 \mathrm{μs}\left({\color{gray}0.024 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 $$11.0 \mathrm{ms} \pm 71.3 \mathrm{μs}\left({\color{gray}-0.656 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$11.0 \mathrm{ms} \pm 64.7 \mathrm{μs}\left({\color{gray}0.235 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$11.1 \mathrm{ms} \pm 85.1 \mathrm{μs}\left({\color{gray}-0.514 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$11.0 \mathrm{ms} \pm 65.2 \mathrm{μs}\left({\color{gray}0.460 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$11.2 \mathrm{ms} \pm 79.4 \mathrm{μs}\left({\color{gray}1.56 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$11.1 \mathrm{ms} \pm 67.5 \mathrm{μs}\left({\color{gray}1.71 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$11.1 \mathrm{ms} \pm 61.1 \mathrm{μs}\left({\color{gray}-0.717 \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.74 \mathrm{ms} \pm 53.0 \mathrm{μs}\left({\color{gray}1.04 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
entity_by_property traversal_paths=0 0 $$55.2 \mathrm{ms} \pm 489 \mathrm{μs}\left({\color{gray}-2.730 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=255 1,resolve_depths=inherit:1;values:255;properties:255;links:127;link_dests:126;type:true $$107 \mathrm{ms} \pm 621 \mathrm{μs}\left({\color{gray}-2.054 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:0;link_dests:0;type:false $$60.2 \mathrm{ms} \pm 429 \mathrm{μs}\left({\color{gray}-3.605 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:1;link_dests:0;type:true $$69.8 \mathrm{ms} \pm 519 \mathrm{μs}\left({\color{gray}-3.967 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:2;links:1;link_dests:0;type:true $$80.0 \mathrm{ms} \pm 396 \mathrm{μs}\left({\color{gray}-0.258 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:2;properties:2;links:1;link_dests:0;type:true $$86.0 \mathrm{ms} \pm 589 \mathrm{μs}\left({\color{gray}-2.267 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=0 0 $$43.5 \mathrm{ms} \pm 284 \mathrm{μs}\left({\color{gray}-2.052 \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 $$74.2 \mathrm{ms} \pm 460 \mathrm{μs}\left({\color{gray}-2.182 \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 $$50.0 \mathrm{ms} \pm 386 \mathrm{μs}\left({\color{gray}-3.370 \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 $$59.4 \mathrm{ms} \pm 403 \mathrm{μs}\left({\color{gray}-1.852 \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 $$63.1 \mathrm{ms} \pm 511 \mathrm{μs}\left({\color{gray}0.879 \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 $$63.5 \mathrm{ms} \pm 525 \mathrm{μs}\left({\color{gray}1.10 \mathrm{\%}}\right) $$

scenarios

Function Value Mean Flame graphs
full_test query-limited $$118 \mathrm{ms} \pm 576 \mathrm{μs}\left({\color{gray}-1.580 \mathrm{\%}}\right) $$ Flame Graph
full_test query-unlimited $$130 \mathrm{ms} \pm 682 \mathrm{μs}\left({\color{gray}0.390 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-limited $$19.1 \mathrm{ms} \pm 156 \mathrm{μs}\left({\color{gray}2.78 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-unlimited $$528 \mathrm{ms} \pm 1.47 \mathrm{ms}\left({\color{gray}3.59 \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.

3 participants