Skip to content

BE-857: atlas: take validated scalars as math operands - #9707

Open
indietyp wants to merge 3 commits into
bm/be-856-atlas-rewrite-the-crate-documentationfrom
bm/be-857-atlas-take-validated-scalars-as-math-operands
Open

indietyp wants to merge 3 commits into
bm/be-856-atlas-rewrite-the-crate-documentationfrom
bm/be-857-atlas-take-validated-scalars-as-math-operands

Conversation

@indietyp

@indietyp indietyp commented Sep 14, 2026

Copy link
Copy Markdown
Member

🌟 What is the purpose of this PR?

Make the atlas math functions take validated scalars as operands. Today they take raw floats and validate inside. A caller that already holds a validated value pays the check again, while a caller that does not can pass a negative repulsion strength or a non-finite exponent, and an inverse of zero has no way to say no. Configuration scalars deserialize as raw floats, and the check runs downstream, where a bad document fails late.

For review, the properties this stands on:

  • An operand's precondition is its type, such as a non-negative strength or a finite exponent. A function whose result can leave its domain returns an option or a derivation, never a raw value that might be out of range.
  • A derivation carries its target domain through the arithmetic and validates once, at its destination. Its typed operators pick the result domain from the scalar operator's output.
  • Narrowing from f64 to f32 rounds in the direction the caller names.

🔍 What does this change?

  • math/scalar/: the validated scalar family and the operators between them.
  • math/derivation/: the derivation type and its exit at the destination domain.
  • math/ (kernel, affinity, similarity, bounds, transform, vec2, dvec2, kdtree): operands converted from raw floats to the scalar that states their precondition.
  • Configuration: scalars such as a base-2 exponent or a ratio above one deserialize through their validating types, so the parser refuses an invalid document.
  • Buffers that zero a block take an allocator.
  • Consumers in salt/projector and cli/tui/render follow the signatures.

⚠️ Breaking Changes & Known Issues

  • The parser refuses a configuration document with an out-of-domain scalar, where the check used to run at first use. A document that loaded before and failed later now fails at load.

❓ How to test this?

  1. cargo nextest run -p hash-graph-atlas --all-features math:: runs the scalar, derivation and kernel tests.
  2. Feed a fit configuration with a ratio of 1.0 in a field that wants a ratio above one and see the parser refuse it.

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

@vercel

vercel Bot commented Sep 14, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
hash Ready Ready Preview Sep 15, 2026 2:50pm UTC
3 Skipped Deployments
Project Deployment Actions Updated
hashdotdesign-tokens Ignored Ignored Preview Sep 15, 2026 2:50pm UTC
petrinaut Skipped Skipped Sep 15, 2026 2:50pm UTC
petrinaut-docs Skipped Skipped Sep 15, 2026 2:50pm UTC

Request Review

@vercel
vercel Bot temporarily deployed to Preview – petrinaut September 14, 2026 13:40 Inactive
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs September 14, 2026 13:40 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 Sep 14, 2026
@indietyp
indietyp deployed to pull-request September 14, 2026 13:41 — with GitHub Actions Active
Comment thread libs/@local/graph/atlas/src/file/generation/tests.rs Fixed
Comment thread libs/@local/graph/atlas/src/math/mod.rs Fixed
Comment thread libs/@local/graph/atlas/src/math/mod.rs Fixed
Comment thread libs/@local/graph/atlas/src/math/mod.rs Fixed
Comment thread libs/@local/graph/atlas/src/math/mod.rs Fixed
Comment thread libs/@local/graph/atlas/src/math/scalar/log2/mod.rs Fixed
Comment thread libs/@local/graph/atlas/src/salt/ladder/paired/fixtures.rs Fixed
@codecov

codecov Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.64850% with 98 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.70%. Comparing base (5e18067) to head (4e692d0).

Files with missing lines Patch % Lines
...ibs/@local/graph/atlas/src/math/scalar/log2/mod.rs 64.28% 15 Missing ⚠️
...al/graph/atlas/src/math/scalar/non_negative/mod.rs 28.57% 15 Missing ⚠️
...raph/atlas/src/math/scalar/greater_than_one/mod.rs 0.00% 14 Missing ⚠️
...s/@local/graph/atlas/src/math/derivation/domain.rs 80.95% 12 Missing ⚠️
libs/@local/graph/atlas/src/math/derivation/mod.rs 92.59% 12 Missing ⚠️
libs/@local/graph/atlas/src/math/bench.rs 0.00% 8 Missing ⚠️
libs/@local/graph/atlas/src/math/bounds/mod.rs 93.40% 4 Missing and 2 partials ⚠️
...l/graph/atlas/src/math/scalar/unit_fraction/mod.rs 33.33% 6 Missing ⚠️
.../graph/atlas/src/math/scalar/d_non_negative/mod.rs 33.33% 4 Missing ⚠️
libs/@local/graph/atlas/src/cli/tui/render/map.rs 70.00% 2 Missing and 1 partial ⚠️
... and 3 more
Additional details and impacted files
@@                                 Coverage Diff                                 @@
##           bm/be-856-atlas-rewrite-the-crate-documentation    #9707      +/-   ##
===================================================================================
+ Coverage                                            71.73%   74.70%   +2.97%     
===================================================================================
  Files                                                 1181      782     -399     
  Lines                                               118685    86834   -31851     
  Branches                                              5190     3627    -1563     
===================================================================================
- Hits                                                 85136    64869   -20267     
+ Misses                                               32490    21283   -11207     
+ Partials                                              1059      682     -377     
Flag Coverage Δ
apps.hash-ai-worker-ts 1.99% <ø> (?)
apps.hash-api ?
apps.hash-graph 13.62% <ø> (ø)
local.hash-backend-utils ?
local.hash-isomorphic-utils ?
rust.hash-graph-api ?
rust.hash-graph-atlas 81.21% <86.64%> (+0.13%) ⬆️
rust.hashql-eval ?
rust.hashql-mir ?

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 added this pull request to stack #9714 September 14, 2026 13:56
@indietyp indietyp self-assigned this Sep 14, 2026
@indietyp indietyp changed the title refactor: take validated scalars as atlas math operands BE-857: atlas: take validated scalars as math operands Sep 14, 2026
@indietyp
indietyp force-pushed the bm/be-857-atlas-take-validated-scalars-as-math-operands branch from 0f3a9f0 to 604fc61 Compare September 14, 2026 14:44
@indietyp
indietyp force-pushed the bm/be-857-atlas-take-validated-scalars-as-math-operands branch from 604fc61 to 228c214 Compare September 14, 2026 15:39
@indietyp
indietyp force-pushed the bm/be-857-atlas-take-validated-scalars-as-math-operands branch from 228c214 to 8f9b1bd Compare September 14, 2026 15:55
@indietyp
indietyp marked this pull request as ready for review September 14, 2026 15:57
Copilot AI balanced review requested due to automatic review settings September 14, 2026 15:57
@cursor

cursor Bot commented Sep 14, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches core UMAP affinity, bounds fitting, and layout numerics with new overflow/refusal paths; invalid config scalars now fail at parse time instead of first use.

Overview
Atlas math now takes validated scalar types (Positive, NonNegative, Finite, and their f64 counterparts) as operands instead of raw floats, so preconditions live in the type system and configuration can reject out-of-domain values at deserialize time.

Affinity and fitting: AffinityCurve stores Positive parameters, accepts NonNegative squared distances and repulsion strength, and routes affinity/gradient math through Derivation so overflows and indeterminate forms fail at validation boundaries. The Levenberg–Marquardt fit accumulates normal equations with derivations and adds overflow tests.

Bounds and TUI: Bounds2 growth (with_minimum_extent, with_aspect_ratio, scaled_about_centre) uses wider f64 corner math and returns Option when corners would leave finite f32 range; serde and zerocopy validation are added. The placement map’s map_bounds propagates that and skips drawing when the viewport is unrepresentable.

Supporting changes: Derivation is split into domain + mod with f32/Finite domain support; FinitePointField gains zeroed_in and copy_from; benchmarks and kernel docs are minor touch-ups.

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

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@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 e1e9724. Configure here.

Comment thread libs/@local/graph/atlas/src/math/scalar/d_positive/mod.rs
@indietyp
indietyp removed this pull request from stack #9714 September 15, 2026 14:38
@indietyp
indietyp requested a review from a team as a code owner September 15, 2026 14:38
@indietyp
indietyp force-pushed the bm/be-857-atlas-take-validated-scalars-as-math-operands branch from 95b5d1b to 1cddf83 Compare September 15, 2026 14:38
@vercel
vercel Bot temporarily deployed to Preview – petrinaut September 15, 2026 14:38 Inactive
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs September 15, 2026 14:38 Inactive
@indietyp
indietyp added this pull request to stack #9738 September 15, 2026 14:39
@indietyp
indietyp deployed to pull-request September 15, 2026 14:39 — with GitHub Actions Active
@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 $$15.1 \mathrm{ms} \pm 178 \mathrm{μs}\left({\color{gray}-3.823 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$1.98 \mathrm{ms} \pm 11.2 \mathrm{μs}\left({\color{gray}-0.458 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1002 $$7.01 \mathrm{ms} \pm 54.7 \mathrm{μs}\left({\color{gray}-1.639 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 3314 $$24.8 \mathrm{ms} \pm 257 \mathrm{μs}\left({\color{gray}-0.013 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$8.84 \mathrm{ms} \pm 69.1 \mathrm{μs}\left({\color{gray}1.08 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 1527 $$13.8 \mathrm{ms} \pm 136 \mathrm{μs}\left({\color{gray}-0.798 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 2078 $$15.7 \mathrm{ms} \pm 189 \mathrm{μs}\left({\color{gray}-3.055 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.19 \mathrm{ms} \pm 10.3 \mathrm{μs}\left({\color{gray}-0.411 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 1033 $$7.56 \mathrm{ms} \pm 79.7 \mathrm{μs}\left({\color{gray}-2.755 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_medium

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 102 $$2.17 \mathrm{ms} \pm 15.6 \mathrm{μs}\left({\color{gray}-0.681 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$1.78 \mathrm{ms} \pm 10.2 \mathrm{μs}\left({\color{gray}-0.437 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 52 $$1.99 \mathrm{ms} \pm 14.7 \mathrm{μs}\left({\color{gray}-0.573 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 269 $$2.96 \mathrm{ms} \pm 14.1 \mathrm{μs}\left({\color{gray}-2.070 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$2.07 \mathrm{ms} \pm 9.93 \mathrm{μs}\left({\color{gray}-0.628 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 108 $$2.36 \mathrm{ms} \pm 9.77 \mathrm{μs}\left({\color{gray}-3.992 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 133 $$2.53 \mathrm{ms} \pm 18.1 \mathrm{μs}\left({\color{gray}-3.025 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.03 \mathrm{ms} \pm 15.2 \mathrm{μs}\left({\color{gray}0.292 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 63 $$2.32 \mathrm{ms} \pm 9.43 \mathrm{μs}\left({\color{gray}-4.048 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_none

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 2 $$1.60 \mathrm{ms} \pm 7.23 \mathrm{μs}\left({\color{gray}0.514 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$1.66 \mathrm{ms} \pm 26.6 \mathrm{μs}\left({\color{red}6.12 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 2 $$1.64 \mathrm{ms} \pm 5.30 \mathrm{μs}\left({\color{gray}-0.708 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 8 $$1.89 \mathrm{ms} \pm 33.9 \mathrm{μs}\left({\color{gray}4.16 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$1.74 \mathrm{ms} \pm 19.4 \mathrm{μs}\left({\color{gray}3.10 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 3 $$1.93 \mathrm{ms} \pm 21.2 \mathrm{μs}\left({\color{gray}2.43 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_small

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 52 $$1.82 \mathrm{ms} \pm 8.94 \mathrm{μs}\left({\color{gray}1.36 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$1.65 \mathrm{ms} \pm 8.58 \mathrm{μs}\left({\color{gray}0.922 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 26 $$1.75 \mathrm{ms} \pm 8.20 \mathrm{μs}\left({\color{gray}-1.371 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 94 $$2.02 \mathrm{ms} \pm 16.5 \mathrm{μs}\left({\color{gray}-0.372 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$1.82 \mathrm{ms} \pm 8.51 \mathrm{μs}\left({\color{gray}-0.154 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 27 $$1.98 \mathrm{ms} \pm 11.9 \mathrm{μs}\left({\color{gray}0.832 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 66 $$1.98 \mathrm{ms} \pm 8.94 \mathrm{μs}\left({\color{gray}0.843 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$1.83 \mathrm{ms} \pm 12.1 \mathrm{μs}\left({\color{gray}1.00 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 29 $$2.01 \mathrm{ms} \pm 19.6 \mathrm{μs}\left({\color{gray}2.67 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_complete

Function Value Mean Flame graphs
entity_by_id;one_depth 1 entities $$18.9 \mathrm{ms} \pm 80.5 \mathrm{μs}\left({\color{gray}-2.661 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 10 entities $$38.7 \mathrm{ms} \pm 199 \mathrm{μs}\left({\color{gray}-0.226 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 25 entities $$20.8 \mathrm{ms} \pm 141 \mathrm{μs}\left({\color{gray}-1.841 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 5 entities $$23.1 \mathrm{ms} \pm 274 \mathrm{μs}\left({\color{gray}3.17 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 50 entities $$24.0 \mathrm{ms} \pm 271 \mathrm{μs}\left({\color{gray}-1.107 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 1 entities $$19.6 \mathrm{ms} \pm 74.7 \mathrm{μs}\left({\color{gray}-2.237 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 10 entities $$217 \mathrm{ms} \pm 951 \mathrm{μs}\left({\color{gray}-0.620 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 25 entities $$48.9 \mathrm{ms} \pm 253 \mathrm{μs}\left({\color{gray}-0.128 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 5 entities $$40.8 \mathrm{ms} \pm 260 \mathrm{μs}\left({\color{gray}-0.914 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 50 entities $$145 \mathrm{ms} \pm 494 \mathrm{μs}\left({\color{gray}-1.242 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 1 entities $$6.23 \mathrm{ms} \pm 61.6 \mathrm{μs}\left({\color{gray}0.790 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 10 entities $$6.24 \mathrm{ms} \pm 28.5 \mathrm{μs}\left({\color{gray}-0.062 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 25 entities $$6.35 \mathrm{ms} \pm 36.0 \mathrm{μs}\left({\color{gray}1.03 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 5 entities $$6.28 \mathrm{ms} \pm 50.5 \mathrm{μs}\left({\color{gray}-1.171 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 50 entities $$6.33 \mathrm{ms} \pm 30.2 \mathrm{μs}\left({\color{gray}-2.245 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_linkless

Function Value Mean Flame graphs
entity_by_id 1 entities $$6.40 \mathrm{ms} \pm 59.5 \mathrm{μs}\left({\color{gray}3.17 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$6.23 \mathrm{ms} \pm 47.0 \mathrm{μs}\left({\color{gray}0.970 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$6.26 \mathrm{ms} \pm 65.1 \mathrm{μs}\left({\color{gray}0.947 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1000 entities $$6.22 \mathrm{ms} \pm 32.0 \mathrm{μs}\left({\color{gray}-0.242 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$6.53 \mathrm{ms} \pm 89.4 \mathrm{μs}\left({\color{gray}1.74 \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 $$6.59 \mathrm{ms} \pm 76.4 \mathrm{μs}\left({\color{gray}1.53 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$6.54 \mathrm{ms} \pm 70.7 \mathrm{μs}\left({\color{gray}1.14 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 $$6.46 \mathrm{ms} \pm 29.5 \mathrm{μs}\left({\color{gray}0.408 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$6.63 \mathrm{ms} \pm 73.1 \mathrm{μs}\left({\color{gray}2.88 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$6.44 \mathrm{ms} \pm 29.2 \mathrm{μs}\left({\color{gray}-3.335 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$6.59 \mathrm{ms} \pm 85.6 \mathrm{μs}\left({\color{gray}0.418 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$6.52 \mathrm{ms} \pm 36.4 \mathrm{μs}\left({\color{gray}1.87 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$6.53 \mathrm{ms} \pm 33.4 \mathrm{μs}\left({\color{gray}1.05 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$6.72 \mathrm{ms} \pm 97.4 \mathrm{μs}\left({\color{gray}3.11 \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 $$4.83 \mathrm{ms} \pm 39.4 \mathrm{μs}\left({\color{gray}1.23 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
entity_by_property traversal_paths=0 0 $$34.9 \mathrm{ms} \pm 343 \mathrm{μs}\left({\color{gray}0.714 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=255 1,resolve_depths=inherit:1;values:255;properties:255;links:127;link_dests:126;type:true $$65.0 \mathrm{ms} \pm 408 \mathrm{μs}\left({\color{gray}1.91 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:0;link_dests:0;type:false $$39.1 \mathrm{ms} \pm 335 \mathrm{μs}\left({\color{red}6.71 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:1;link_dests:0;type:true $$44.9 \mathrm{ms} \pm 444 \mathrm{μs}\left({\color{gray}4.76 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:2;links:1;link_dests:0;type:true $$48.7 \mathrm{ms} \pm 277 \mathrm{μs}\left({\color{gray}0.708 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:2;properties:2;links:1;link_dests:0;type:true $$52.9 \mathrm{ms} \pm 356 \mathrm{μs}\left({\color{gray}2.05 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=0 0 $$27.2 \mathrm{ms} \pm 165 \mathrm{μs}\left({\color{red}9.03 \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 $$44.3 \mathrm{ms} \pm 319 \mathrm{μs}\left({\color{red}7.80 \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 $$31.2 \mathrm{ms} \pm 234 \mathrm{μs}\left({\color{red}5.67 \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 $$35.9 \mathrm{ms} \pm 225 \mathrm{μs}\left({\color{gray}2.69 \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 $$36.1 \mathrm{ms} \pm 260 \mathrm{μs}\left({\color{gray}2.41 \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 $$34.4 \mathrm{ms} \pm 281 \mathrm{μs}\left({\color{lightgreen}-7.006 \mathrm{\%}}\right) $$

scenarios

Function Value Mean Flame graphs
full_test query-limited $$68.9 \mathrm{ms} \pm 349 \mathrm{μs}\left({\color{gray}2.08 \mathrm{\%}}\right) $$ Flame Graph
full_test query-unlimited $$73.9 \mathrm{ms} \pm 321 \mathrm{μs}\left({\color{gray}-0.559 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-limited $$9.99 \mathrm{ms} \pm 49.4 \mathrm{μs}\left({\color{lightgreen}-20.582 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-unlimited $$301 \mathrm{ms} \pm 821 \mathrm{μs}\left({\color{gray}-1.576 \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