Skip to content

BE-583, BE-584, BE-586: HashQL: Add HeapPool, improve spans, and propagate Critical severity through diagnostics#8836

Merged
indietyp merged 2 commits into
mainfrom
bm/be-583-hashql-diagnostics-docs-and-span-improvements
Jun 12, 2026
Merged

BE-583, BE-584, BE-586: HashQL: Add HeapPool, improve spans, and propagate Critical severity through diagnostics#8836
indietyp merged 2 commits into
mainfrom
bm/be-583-hashql-diagnostics-docs-and-span-improvements

Conversation

@indietyp

@indietyp indietyp commented Jun 8, 2026

Copy link
Copy Markdown
Member

🌟 What is the purpose of this PR?

This PR introduces a HeapPool type (mirroring the existing ScratchPool) for pooling and reusing Heap allocators across threads, and rewrites the underlying pool implementation to use a plain Mutex<Vec<_>> instead of bump_scope::BumpPool. Both pool types now support optional bounded capacity via a bounded(max_size) constructor, and guards return their allocator to the pool (after resetting it) on drop.

Alongside the pool work, the JExpr parser and lexer diagnostics are tightened so that all error-producing functions return Diagnostic<_, _, Critical> directly rather than the generic Severity-parameterised form. This removes the runtime severity-checking workaround in the entity query REST handler and makes the type system enforce that parse errors are always critical. The ancestors method on SpanTable is also changed from returning a Vec<SpanId> to returning a lazy iterator that includes the queried span itself, uses a DenseBitSet for deduplication, and skips unresolvable spans.

Additional smaller additions include map_spans on DiagnosticIssues and StatusExt, From<Vec<Diagnostic>> and serde impls for DiagnosticIssues, serde derives for Success and Failure, a new IntoStatus trait for converting Result<T, Diagnostic<C, S, Critical>> into a Status, and LocalSpanId as a typed newtype for the local portion of a SpanId.

🔍 What does this change?

  • Replaces bump_scope::BumpPool-backed ScratchPool with a Mutex<Vec<Scratch>>-based implementation; adds an equivalent HeapPool / HeapPoolGuard pair for pooling Heap allocators.
  • Both pool types expose new() (unbounded) and bounded(max_size) constructors; guards reset and return their allocator on drop, dropping it instead when the pool is at capacity.
  • Exports HeapPool and HeapPoolGuard from hashql_core::heap.
  • Removes the rpds std feature flag (no longer needed).
  • Enables the nonpoison_mutex and sync_nonpoison nightly features in hashql_core.
  • Changes all JExpr lexer and parser diagnostic constructors to use Critical::ERROR instead of Severity::Error, and updates all Diagnostic type aliases to default their severity kind parameter to Critical.
  • Removes the runtime severity-mapping workaround in EntityQuery::parse_expr; Failure::new is now called directly on the already-critical diagnostic.
  • Adds Diagnostic::generalize call in the compiletest pipeline before Diagnostic::boxed.
  • Refactors SpanTable::ancestors to return a lazy impl IntoIterator<Item = SpanId> that yields the queried span first, uses DenseBitSet for O(1) duplicate detection, and skips spans not present in the table.
  • Introduces LocalSpanId as a typed newtype (bounded 0..=SpanId::MAX_ID) for the local index portion of a SpanId; SpanId::id() now returns LocalSpanId.
  • Adds DiagnosticIssues::map_spans, StatusExt::map_spans, From<Vec<Diagnostic>> for DiagnosticIssues, and serde Serialize/Deserialize impls for DiagnosticIssues, Success, and Failure.
  • Adds the IntoStatus trait and a blanket impl for Result<T, Diagnostic<C, S, Critical>>, exported from hashql_diagnostics.
  • Adds Failure::new doc example and #[inline] annotations on various small accessor methods.
  • Adds compile-time Send/Sync assertions for all four pool types.
  • Adds unit tests for ScratchPool and HeapPool covering reuse, concurrent demand, and bounded-capacity behaviour.

🛡 What tests cover this?

  • New unit tests in hashql_core::heap::pool covering ScratchPool and HeapPool reuse, concurrent borrowing, and bounded-capacity eviction.
  • Existing compiletest and snapshot tests for the JExpr parser continue to exercise the diagnostic paths.

❓ How to test this?

  1. Run cargo test -p hashql-core and confirm the new pool tests pass.
  2. Run cargo test -p hashql-syntax-jexpr and confirm all parser/lexer snapshot tests are unchanged.
  3. Run the full test suite and confirm no regressions in entity query handling.

indietyp added 2 commits June 8, 2026 11:52
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 parallel allocator pooling (thread safety) and changes span ancestor iteration semantics (includes self, lazy); entity query error handling is simplified but behavior should stay equivalent for parse failures.

Overview
Replaces ScratchPool’s bump_scope::BumpPool backend with a Mutex<Vec<Scratch>> design and adds a parallel HeapPool / HeapPoolGuard for reusing Heap allocators across threads. Both pools support new() and bounded(max_size); guards deref to the allocator, reset it on drop, and return it to the pool (or drop when over capacity). HeapPool is re-exported from hashql_core::heap.

J-Expr lexer/parser diagnostics now default to Critical and use Critical::ERROR at construction sites, so parse failures are critical by type. The entity query REST path drops the runtime map_severity workaround and wraps J-Expr errors with Failure::new after category mapping only.

SpanTable::ancestors becomes a lazy iterator that yields the queried span first, deduplicates with DenseBitSet, and skips missing entries; SpanId::id() returns a typed LocalSpanId.

Diagnostics gains map_spans on DiagnosticIssues and StatusExt, IntoStatus for Result<T, Diagnostic<_, _, Critical>>, From<Vec<Diagnostic>> for issues, and serde on Success, Failure, and DiagnosticIssues. Compiletest parse errors call Diagnostic::generalize before boxing.

Reviewed by Cursor Bugbot for commit d854dc5. 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 12, 2026 11:17am
petrinaut Ready Ready Preview Jun 12, 2026 11:17am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview Jun 12, 2026 11:17am

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

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.84848% with 35 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.22%. Comparing base (bf6fe44) to head (d854dc5).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
libs/@local/hashql/diagnostics/src/issues.rs 32.00% 17 Missing ⚠️
libs/@local/hashql/core/src/heap/pool.rs 93.28% 9 Missing ⚠️
libs/@local/hashql/diagnostics/src/status.rs 75.00% 4 Missing ⚠️
libs/@local/hashql/core/src/span/table.rs 84.61% 1 Missing and 1 partial ⚠️
.../@local/graph/api/src/rest/entity_query_request.rs 0.00% 1 Missing ⚠️
libs/@local/hashql/compiletest/src/pipeline.rs 0.00% 1 Missing ⚠️
libs/@local/hashql/core/src/span/mod.rs 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8836      +/-   ##
==========================================
+ Coverage   59.15%   59.22%   +0.06%     
==========================================
  Files        1346     1346              
  Lines      130117   130200      +83     
  Branches     5883     5883              
==========================================
+ Hits        76975    77115     +140     
+ Misses      52237    52180      -57     
  Partials      905      905              
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.52% <0.00%> (+<0.01%) ⬆️
rust.hashql-ast 87.23% <ø> (ø)
rust.hashql-compiletest 28.24% <0.00%> (-0.02%) ⬇️
rust.hashql-core 79.80% <92.05%> (+0.37%) ⬆️
rust.hashql-diagnostics 72.31% <48.78%> (-0.22%) ⬇️
rust.hashql-eval 75.69% <ø> (ø)
rust.hashql-hir 89.06% <ø> (ø)
rust.hashql-mir 87.05% <ø> (ø)
rust.hashql-syntax-jexpr 94.04% <100.00%> (-0.02%) ⬇️

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 strengthens HashQL’s allocator and diagnostics infrastructure by introducing pooled Heap allocators (HeapPool) alongside a rewritten ScratchPool implementation, and by making JExpr lexer/parser errors statically critical (Diagnostic<…, Critical>) so downstream callers don’t need runtime severity enforcement. It also refactors span ancestry traversal for better ergonomics/perf characteristics and adds new diagnostic/status utilities (including span-mapping and serde support).

Changes:

  • Replaces the bump_scope::BumpPool-backed ScratchPool with a Mutex<Vec<_>> pool, adds HeapPool, and adds bounded-capacity retention with guard-return-on-drop semantics.
  • Propagates Critical severity through JExpr lexer/parser diagnostics and removes runtime “ensure critical” mapping in the entity query REST handler.
  • Refactors SpanTable::ancestors to yield a lazy, deduplicated iterator (including the span itself) and adds LocalSpanId for typed local span indices; adds span/category mapping helpers + serde support in diagnostics.

Reviewed changes

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

Show a summary per file
File Description
libs/@local/hashql/syntax-jexpr/src/test.rs Makes diagnostic rendering helper generic over severity kind.
libs/@local/hashql/syntax-jexpr/src/parser/string/error.rs Switches string parser diagnostics to Critical (defaulted type alias + constructors).
libs/@local/hashql/syntax-jexpr/src/parser/state.rs Adds #[inline] to Expected conversions.
libs/@local/hashql/syntax-jexpr/src/parser/object/visit.rs Forces object visitor diagnostics to be Critical.
libs/@local/hashql/syntax-jexpr/src/parser/object/error.rs Switches object diagnostics to Critical and updates constructors.
libs/@local/hashql/syntax-jexpr/src/parser/error.rs Switches parser diagnostics to Critical and inlines category conversions.
libs/@local/hashql/syntax-jexpr/src/parser/complex/mod.rs Forces complex parser verification diagnostics to be Critical.
libs/@local/hashql/syntax-jexpr/src/parser/array/visit.rs Forces array visitor diagnostics to be Critical.
libs/@local/hashql/syntax-jexpr/src/parser/array/error.rs Switches array diagnostics to Critical and updates constructors.
libs/@local/hashql/syntax-jexpr/src/lexer/syntax_kind_set.rs Adds #[inline] to small impls.
libs/@local/hashql/syntax-jexpr/src/lexer/mod.rs Updates lexer error type alias usage (LexerDiagnostic) and signatures.
libs/@local/hashql/syntax-jexpr/src/lexer/error.rs Switches lexer diagnostics to Critical and updates constructors.
libs/@local/hashql/syntax-jexpr/src/error.rs Generalizes ResultExt over severity kind and updates JExpr diagnostic alias default.
libs/@local/hashql/diagnostics/src/status.rs Adds serde derives for Success/Failure, adds StatusExt::map_spans, and introduces IntoStatus.
libs/@local/hashql/diagnostics/src/source/span.rs Adds #[inline] on SourceSpan accessors.
libs/@local/hashql/diagnostics/src/lib.rs Re-exports IntoStatus.
libs/@local/hashql/diagnostics/src/issues.rs Adds DiagnosticIssues::map_spans, From<Vec<Diagnostic>>, and serde impls.
libs/@local/hashql/core/src/span/table.rs Refactors SpanTable::ancestors to a lazy iterator with DenseBitSet dedup; adjusts indexing for LocalSpanId.
libs/@local/hashql/core/src/span/mod.rs Introduces LocalSpanId and updates SpanId::id() return type.
libs/@local/hashql/core/src/pretty/formatter.rs Adds #[inline] to FormatterOptions::default().
libs/@local/hashql/core/src/module/namespace.rs Adds #[inline] to ModuleNamespace::registry().
libs/@local/hashql/core/src/lib.rs Enables nightly nonpoison_mutex/sync_nonpoison and reorganizes feature list.
libs/@local/hashql/core/src/id/bit_vec/mod.rs Adds #[inline] to bitset domain_size() accessors.
libs/@local/hashql/core/src/heap/scratch.rs Minor attribute ordering and adds #[inline] to Default.
libs/@local/hashql/core/src/heap/pool.rs Reimplements ScratchPool using Mutex<Vec<_>>, adds HeapPool, bounded capacity, guard drop-return, and unit tests.
libs/@local/hashql/core/src/heap/mod.rs Exports HeapPool/HeapPoolGuard and adds #[inline] to Heap::default().
libs/@local/hashql/core/src/graph/algorithms/dominators/frontier.rs Adds #[inline] to a small accessor.
libs/@local/hashql/core/src/collections/pool.rs Adds #[inline] to VecPool::capacity().
libs/@local/hashql/core/Cargo.toml Drops the rpds std feature flag.
libs/@local/hashql/compiletest/src/pipeline.rs Generalizes diagnostics before boxing in the parse stage.
libs/@local/graph/api/src/rest/entity_query_request.rs Removes runtime severity mapping; constructs Failure directly from critical diagnostics.

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

Comment thread libs/@local/hashql/core/src/heap/pool.rs
Comment thread libs/@local/hashql/core/src/heap/pool.rs
@codspeed-hq

codspeed-hq Bot commented Jun 8, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 14.9%

⚠️ 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

⚡ 5 improved benchmarks
✅ 75 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
bit_matrix/dense/iter_row[64] 170 ns 140.8 ns +20.71%
bit_matrix/dense/iter_row[200] 215 ns 185.8 ns +15.7%
linear 7.6 µs 6.7 µs +14%
diamond 12.3 µs 10.9 µs +12.79%
complex 18.1 µs 16.2 µs +11.53%

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-583-hashql-diagnostics-docs-and-span-improvements (d854dc5) with main (bf6fe44)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (f5cd3ed) during the generation of this report, so bf6fe44 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-582-hashql-make-opaque-types-covariant-in-their-inner branch from fc41426 to f4fbb1d Compare June 9, 2026 07:17
@indietyp indietyp force-pushed the bm/be-583-hashql-diagnostics-docs-and-span-improvements branch from a58069f to e6657ac Compare June 9, 2026 07:17

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 e6657ac. Configure here.

Comment thread libs/@local/hashql/core/src/span/table.rs
TimDiekmann
TimDiekmann previously approved these changes Jun 12, 2026
Base automatically changed from bm/be-582-hashql-make-opaque-types-covariant-in-their-inner to main June 12, 2026 09:14
@indietyp indietyp dismissed TimDiekmann’s stale review June 12, 2026 09:14

The base branch was changed.

@github-actions github-actions Bot added the area/tests New or updated tests label Jun 12, 2026
@indietyp indietyp requested a review from TimDiekmann June 12, 2026 11:02
@TimDiekmann

Copy link
Copy Markdown
Member

The branch was not rebased, yet.

@TimDiekmann TimDiekmann removed their request for review June 12, 2026 11:03
@indietyp indietyp force-pushed the bm/be-583-hashql-diagnostics-docs-and-span-improvements branch from e6657ac to d854dc5 Compare June 12, 2026 11:08
Copilot AI review requested due to automatic review settings June 12, 2026 11:08
@github-actions github-actions Bot removed the area/tests New or updated tests label Jun 12, 2026
@indietyp indietyp requested a review from TimDiekmann June 12, 2026 11:08
@indietyp indietyp enabled auto-merge June 12, 2026 11:09

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 31 out of 31 changed files in this pull request and generated no new comments.

@indietyp indietyp added this pull request to the merge queue Jun 12, 2026
Merged via the queue into main with commit dfe8234 Jun 12, 2026
97 checks passed
@indietyp indietyp deleted the bm/be-583-hashql-diagnostics-docs-and-span-improvements branch June 12, 2026 11:47
@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.1 \mathrm{ms} \pm 262 \mathrm{μs}\left({\color{gray}0.013 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$3.35 \mathrm{ms} \pm 23.6 \mathrm{μs}\left({\color{gray}-0.251 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1001 $$13.2 \mathrm{ms} \pm 121 \mathrm{μs}\left({\color{red}6.87 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 3314 $$43.2 \mathrm{ms} \pm 310 \mathrm{μs}\left({\color{gray}2.72 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$15.0 \mathrm{ms} \pm 116 \mathrm{μs}\left({\color{red}7.78 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 1526 $$24.2 \mathrm{ms} \pm 196 \mathrm{μs}\left({\color{gray}2.28 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 2078 $$28.6 \mathrm{ms} \pm 233 \mathrm{μs}\left({\color{gray}1.89 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.72 \mathrm{ms} \pm 27.8 \mathrm{μs}\left({\color{gray}2.33 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 1033 $$14.3 \mathrm{ms} \pm 149 \mathrm{μs}\left({\color{red}5.89 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_medium

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 102 $$3.81 \mathrm{ms} \pm 24.7 \mathrm{μs}\left({\color{gray}3.10 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.97 \mathrm{ms} \pm 15.8 \mathrm{μs}\left({\color{gray}2.58 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 51 $$3.32 \mathrm{ms} \pm 17.6 \mathrm{μs}\left({\color{gray}2.87 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 269 $$5.18 \mathrm{ms} \pm 42.9 \mathrm{μs}\left({\color{gray}1.75 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$3.49 \mathrm{ms} \pm 24.6 \mathrm{μs}\left({\color{gray}0.820 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 107 $$4.10 \mathrm{ms} \pm 23.9 \mathrm{μs}\left({\color{gray}0.738 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 133 $$4.38 \mathrm{ms} \pm 26.2 \mathrm{μs}\left({\color{gray}1.76 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.45 \mathrm{ms} \pm 19.9 \mathrm{μs}\left({\color{gray}2.89 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 63 $$4.06 \mathrm{ms} \pm 26.8 \mathrm{μs}\left({\color{gray}2.66 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_none

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 2 $$2.63 \mathrm{ms} \pm 15.4 \mathrm{μs}\left({\color{gray}2.56 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.48 \mathrm{ms} \pm 15.9 \mathrm{μs}\left({\color{gray}-0.222 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1 $$2.62 \mathrm{ms} \pm 19.4 \mathrm{μs}\left({\color{gray}4.31 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 8 $$2.89 \mathrm{ms} \pm 17.4 \mathrm{μs}\left({\color{gray}3.92 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.68 \mathrm{ms} \pm 16.1 \mathrm{μs}\left({\color{gray}3.18 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 3 $$2.90 \mathrm{ms} \pm 19.5 \mathrm{μs}\left({\color{gray}4.81 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_small

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 52 $$2.97 \mathrm{ms} \pm 19.7 \mathrm{μs}\left({\color{gray}-0.123 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.71 \mathrm{ms} \pm 15.0 \mathrm{μs}\left({\color{gray}-0.308 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 25 $$2.95 \mathrm{ms} \pm 19.4 \mathrm{μs}\left({\color{gray}0.479 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 94 $$3.38 \mathrm{ms} \pm 20.9 \mathrm{μs}\left({\color{gray}0.555 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$2.92 \mathrm{ms} \pm 22.4 \mathrm{μs}\left({\color{gray}-0.380 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 26 $$3.27 \mathrm{ms} \pm 19.2 \mathrm{μs}\left({\color{gray}1.25 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 66 $$3.33 \mathrm{ms} \pm 24.3 \mathrm{μs}\left({\color{gray}1.75 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.89 \mathrm{ms} \pm 14.3 \mathrm{μs}\left({\color{gray}0.947 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 29 $$3.28 \mathrm{ms} \pm 18.6 \mathrm{μs}\left({\color{gray}1.02 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_complete

Function Value Mean Flame graphs
entity_by_id;one_depth 1 entities $$54.8 \mathrm{ms} \pm 381 \mathrm{μs}\left({\color{gray}0.130 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 10 entities $$45.6 \mathrm{ms} \pm 246 \mathrm{μs}\left({\color{gray}-2.474 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 25 entities $$50.6 \mathrm{ms} \pm 278 \mathrm{μs}\left({\color{gray}1.73 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 5 entities $$47.5 \mathrm{ms} \pm 983 \mathrm{μs}\left({\color{lightgreen}-13.144 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 50 entities $$62.0 \mathrm{ms} \pm 415 \mathrm{μs}\left({\color{gray}-3.359 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 1 entities $$61.8 \mathrm{ms} \pm 353 \mathrm{μs}\left({\color{gray}-0.907 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 10 entities $$56.1 \mathrm{ms} \pm 366 \mathrm{μs}\left({\color{gray}-0.610 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 25 entities $$99.7 \mathrm{ms} \pm 608 \mathrm{μs}\left({\color{gray}-4.117 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 5 entities $$46.7 \mathrm{ms} \pm 347 \mathrm{μs}\left({\color{lightgreen}-24.649 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 50 entities $$297 \mathrm{ms} \pm 1.30 \mathrm{ms}\left({\color{gray}1.57 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 1 entities $$19.6 \mathrm{ms} \pm 132 \mathrm{μs}\left({\color{gray}0.804 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 10 entities $$20.1 \mathrm{ms} \pm 126 \mathrm{μs}\left({\color{gray}1.78 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 25 entities $$20.3 \mathrm{ms} \pm 103 \mathrm{μs}\left({\color{gray}0.879 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 5 entities $$19.4 \mathrm{ms} \pm 140 \mathrm{μs}\left({\color{gray}-0.457 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 50 entities $$25.3 \mathrm{ms} \pm 125 \mathrm{μs}\left({\color{gray}0.267 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_linkless

Function Value Mean Flame graphs
entity_by_id 1 entities $$19.5 \mathrm{ms} \pm 163 \mathrm{μs}\left({\color{gray}-0.090 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$19.2 \mathrm{ms} \pm 133 \mathrm{μs}\left({\color{gray}-2.709 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$19.3 \mathrm{ms} \pm 146 \mathrm{μs}\left({\color{gray}0.324 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1000 entities $$20.5 \mathrm{ms} \pm 108 \mathrm{μs}\left({\color{gray}0.663 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$27.2 \mathrm{ms} \pm 222 \mathrm{μs}\left({\color{gray}0.286 \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 286 \mathrm{μs}\left({\color{gray}4.20 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$36.2 \mathrm{ms} \pm 296 \mathrm{μs}\left({\color{gray}4.04 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 $$34.7 \mathrm{ms} \pm 329 \mathrm{μs}\left({\color{gray}-0.785 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$34.0 \mathrm{ms} \pm 301 \mathrm{μs}\left({\color{lightgreen}-5.674 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$35.5 \mathrm{ms} \pm 310 \mathrm{μs}\left({\color{gray}1.52 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$35.0 \mathrm{ms} \pm 326 \mathrm{μs}\left({\color{gray}2.84 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$35.0 \mathrm{ms} \pm 320 \mathrm{μs}\left({\color{gray}0.618 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$35.6 \mathrm{ms} \pm 318 \mathrm{μs}\left({\color{gray}3.89 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$35.0 \mathrm{ms} \pm 334 \mathrm{μs}\left({\color{gray}-0.144 \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.49 \mathrm{ms} \pm 55.9 \mathrm{μs}\left({\color{gray}2.38 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
entity_by_property traversal_paths=0 0 $$95.3 \mathrm{ms} \pm 550 \mathrm{μs}\left({\color{gray}3.02 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=255 1,resolve_depths=inherit:1;values:255;properties:255;links:127;link_dests:126;type:true $$150 \mathrm{ms} \pm 688 \mathrm{μs}\left({\color{gray}1.48 \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 880 \mathrm{μs}\left({\color{gray}1.98 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:1;link_dests:0;type:true $$115 \mathrm{ms} \pm 730 \mathrm{μs}\left({\color{gray}3.79 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:2;links:1;link_dests:0;type:true $$120 \mathrm{ms} \pm 706 \mathrm{μs}\left({\color{gray}2.49 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:2;properties:2;links:1;link_dests:0;type:true $$129 \mathrm{ms} \pm 713 \mathrm{μs}\left({\color{gray}1.79 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=0 0 $$104 \mathrm{ms} \pm 646 \mathrm{μs}\left({\color{gray}1.82 \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 $$136 \mathrm{ms} \pm 1.03 \mathrm{ms}\left({\color{gray}3.32 \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 669 \mathrm{μs}\left({\color{red}5.17 \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 710 \mathrm{μs}\left({\color{gray}3.58 \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 $$124 \mathrm{ms} \pm 662 \mathrm{μs}\left({\color{gray}3.78 \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 $$123 \mathrm{ms} \pm 634 \mathrm{μs}\left({\color{gray}3.20 \mathrm{\%}}\right) $$

scenarios

Function Value Mean Flame graphs
full_test query-limited $$157 \mathrm{ms} \pm 2.61 \mathrm{ms}\left({\color{lightgreen}-12.132 \mathrm{\%}}\right) $$ Flame Graph
full_test query-unlimited $$145 \mathrm{ms} \pm 898 \mathrm{μs}\left({\color{lightgreen}-25.404 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-limited $$41.2 \mathrm{ms} \pm 294 \mathrm{μs}\left({\color{gray}2.34 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-unlimited $$542 \mathrm{ms} \pm 1.63 \mathrm{ms}\left({\color{gray}-1.560 \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) type/eng > backend Owned by the @backend team

Development

Successfully merging this pull request may close these issues.

3 participants