Skip to content

BE-525: HashQL: Remove implicit type-widening from Integer operations, and make comparison size aware#8693

Merged
indietyp merged 4 commits into
mainfrom
bm/be-525-hashql-remove-implicit-type-widening-into-num-for-int
Jun 1, 2026
Merged

BE-525: HashQL: Remove implicit type-widening from Integer operations, and make comparison size aware#8693
indietyp merged 4 commits into
mainfrom
bm/be-525-hashql-remove-implicit-type-widening-into-num-for-int

Conversation

@indietyp

@indietyp indietyp commented May 4, 2026

Copy link
Copy Markdown
Member

🌟 What is the purpose of this PR?

Integer arithmetic in the MIR interpreter previously silently promoted overflowing i128 operations to floating-point results via a Numeric enum. This was semantically incorrect: the language specifies arbitrary-precision integers, and silently widening to f64 loses precision and masks errors. This PR replaces that silent promotion with explicit overflow detection, surfacing a user-facing IntegerOverflow runtime error when addition, subtraction, or negation exceeds the 128-bit range supported by the interpreter.

As a side effect, the Int type's equality, ordering, and hashing semantics are corrected so that booleans (1-bit integers) are treated as a distinct type from integers (128-bit), rather than comparing equal to numeric integers with the same value. This restores type-level correctness for Bool vs Int comparisons throughout the value layer.

🔍 What does this change?

  • Adds a RuntimeError::IntegerOverflow variant with an operation field, and a corresponding integer_overflow diagnostic emitted under the RuntimeLimit category with a note that the interpreter supports up to 128-bit integers.
  • Replaces the Neg, Add<Int>, and Sub<Int> operator impls on Int (which returned Numeric and silently promoted to f64 on overflow) with checked_neg, checked_add, and checked_sub methods that return Option<Int>.
  • Removes the Numeric enum entirely, along with the From<Numeric> for Value conversion and all associated forwarding impls.
  • Updates the binary and unary operation dispatch in the interpreter runtime to use the new checked methods and return RuntimeError::IntegerOverflow on None.
  • Fixes Int's PartialEq, Ord, and Hash implementations to include the size field, so that Int::from(true) (1-bit) and Int::from(1_i32) (128-bit) are no longer considered equal.
  • Fixes PartialEq<Int> for Num, PartialOrd<Int> for Num, and their reverses to return false/None when the Int is a boolean, since booleans are not a subtype of Number.
  • Updates Value::Ord to guard the cross-type Integer/Number ordering arms with !this.is_bool() / !other.is_bool().
  • Updates InstSimplifyVisitor::eval_un_op to return Option<Int> and skip constant folding for negation of i128::MIN.
  • Adds interpreter tests for addition, subtraction, and negation overflow, and an inst_simplify test confirming that neg(i128::MIN) is not folded.
  • Updates all unit tests in int.rs and mod.rs to reflect the corrected bool/int distinction.

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 interpreter tests: integer_add_overflow, integer_sub_overflow, integer_neg_overflow — each confirms a RuntimeLimit diagnostic is produced.
  • New inst_simplify test: const_fold_neg_overflow — confirms that negation of i128::MIN is left unfolded.
  • Updated unit tests in Int and Value covering corrected equality, ordering, hashing, and cross-type Num/Int comparisons.

❓ How to test this?

  1. Run cargo test -p hashql-mir and confirm all tests pass.
  2. Verify that the new snapshot const_fold_neg_overflow.snap matches the expected unfold output.
  3. Confirm that expressions producing integer overflow at runtime emit a diagnostic with category RuntimeLimit and a message referencing the 128-bit limit.

@vercel

vercel Bot commented May 4, 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 May 29, 2026 4:41pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview May 29, 2026 4:41pm
petrinaut Skipped Skipped May 29, 2026 4:41pm

@vercel vercel Bot temporarily deployed to Preview – petrinaut May 4, 2026 10:33 Inactive
@cursor

cursor Bot commented May 4, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes core interpreter arithmetic and value equality semantics; well-typed programs may see new overflow errors or different comparison/fold behavior at bool/int boundaries.

Overview
The MIR interpreter stops silently promoting overflowing i128 integer math to f64. Integer add, sub, and neg now use checked operations and surface a user-facing IntegerOverflow runtime error (under RuntimeLimit) when results fall outside the supported 128-bit range.

The Numeric wrapper and overflow-to-float paths are removed. Int equality, ordering, and hashing now treat booleans (1-bit) and integers (128-bit) as distinct even when the numeric bits match; Num cross-comparisons with bools are adjusted accordingly, and Value / inst_simplify constant folding follows size-aware == / != (including folding bool-vs-int comparisons to false / true where appropriate).

Reviewed by Cursor Bugbot for commit bf3b42f. 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

indietyp commented May 4, 2026

Copy link
Copy Markdown
Member Author

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

@augmentcode

augmentcode Bot commented May 4, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: This PR fixes HashQL MIR interpreter integer semantics by removing implicit type-widening on overflow and making comparisons size-aware.

Changes:

  • Adds RuntimeError::IntegerOverflow plus a new RuntimeLimit diagnostic for i128-range overflows.
  • Updates runtime dispatch for Add/Sub/Neg on Int to use checked arithmetic and surface overflow as an explicit runtime error.
  • Removes the Numeric enum and associated conversion plumbing that previously promoted overflowing Int operations into f64.
  • Makes Int equality/ordering/hashing include the size field so Bool (1-bit) and Int (128-bit) are distinct at the value layer.
  • Adjusts NumInt cross-type comparison to treat booleans as neither equal nor orderable with Num.
  • Updates Value::Ord to only apply numeric ordering between Integer/Number for non-bool integers.
  • Updates constant folding to avoid folding neg(i128::MIN) and adds interpreter + inst_simplify regression tests/snapshots for overflow cases.

🤖 Was this summary useful? React with 👍 or 👎

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

Review completed. 1 suggestion posted.

Fix All in Augment

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

Comment thread libs/@local/hashql/mir/src/interpret/value/int.rs
@codecov

codecov Bot commented May 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.00%. Comparing base (b9e62e0) to head (bf3b42f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8693      +/-   ##
==========================================
- Coverage   59.02%   59.00%   -0.03%     
==========================================
  Files        1341     1341              
  Lines      129299   129178     -121     
  Branches     5823     5803      -20     
==========================================
- Hits        76317    76219      -98     
+ Misses      52085    52074      -11     
+ Partials      897      885      -12     
Flag Coverage Δ
apps.hash-api 0.00% <ø> (ø)

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.

@codspeed-hq

codspeed-hq Bot commented May 4, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 24 untouched benchmarks
⏩ 56 skipped benchmarks1


Comparing bm/be-525-hashql-remove-implicit-type-widening-into-num-for-int (bf3b42f) with main (73a14b4)2

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.

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

@vercel vercel Bot temporarily deployed to Preview – petrinaut May 4, 2026 10:39 Inactive
@vercel vercel Bot temporarily deployed to Preview – petrinaut May 25, 2026 13:58 Inactive
@indietyp indietyp force-pushed the bm/be-525-hashql-remove-implicit-type-widening-into-num-for-int branch from bec8970 to 7e018f0 Compare May 25, 2026 14:01
@indietyp indietyp force-pushed the bm/be-515-hashql-remove-offset-0-materialization-fence-from-generated branch from 4081227 to 403e916 Compare May 25, 2026 14:01
@indietyp indietyp force-pushed the bm/be-515-hashql-remove-offset-0-materialization-fence-from-generated branch from 403e916 to ed78af0 Compare May 26, 2026 07:25
@indietyp indietyp force-pushed the bm/be-525-hashql-remove-implicit-type-widening-into-num-for-int branch from 7e018f0 to 9fcabac Compare May 26, 2026 07:25
@indietyp indietyp force-pushed the bm/be-525-hashql-remove-implicit-type-widening-into-num-for-int branch from 9fcabac to 7533415 Compare May 27, 2026 07:11
@indietyp indietyp force-pushed the bm/be-515-hashql-remove-offset-0-materialization-fence-from-generated branch from ed78af0 to 42733cd Compare May 27, 2026 07:11
@indietyp indietyp force-pushed the bm/be-515-hashql-remove-offset-0-materialization-fence-from-generated branch from 42733cd to f8e03c7 Compare May 28, 2026 13:27
@indietyp indietyp force-pushed the bm/be-525-hashql-remove-implicit-type-widening-into-num-for-int branch from 7533415 to e34da12 Compare May 28, 2026 13:27
TimDiekmann
TimDiekmann previously approved these changes May 28, 2026
Base automatically changed from bm/be-515-hashql-remove-offset-0-materialization-fence-from-generated to main May 29, 2026 16:33
@indietyp indietyp force-pushed the bm/be-525-hashql-remove-implicit-type-widening-into-num-for-int branch from e34da12 to bf3b42f Compare May 29, 2026 16:33
@graphite-app

graphite-app Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

Merge activity

  • May 29, 4:34 PM UTC: Graphite rebased this pull request, because this pull request is set to merge when ready.

@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 $$19.6 \mathrm{ms} \pm 114 \mathrm{μs}\left({\color{gray}-0.143 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.64 \mathrm{ms} \pm 11.1 \mathrm{μs}\left({\color{gray}0.011 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1001 $$9.57 \mathrm{ms} \pm 66.1 \mathrm{μs}\left({\color{gray}-1.723 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 3314 $$33.2 \mathrm{ms} \pm 218 \mathrm{μs}\left({\color{gray}-0.212 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$11.9 \mathrm{ms} \pm 93.4 \mathrm{μs}\left({\color{red}7.26 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 1526 $$19.9 \mathrm{ms} \pm 139 \mathrm{μs}\left({\color{red}6.14 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 2078 $$20.1 \mathrm{ms} \pm 113 \mathrm{μs}\left({\color{gray}-0.976 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.82 \mathrm{ms} \pm 11.7 \mathrm{μs}\left({\color{gray}-1.779 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 1033 $$10.4 \mathrm{ms} \pm 68.6 \mathrm{μs}\left({\color{gray}-4.002 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_medium

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 102 $$2.88 \mathrm{ms} \pm 15.5 \mathrm{μs}\left({\color{gray}0.225 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.29 \mathrm{ms} \pm 9.97 \mathrm{μs}\left({\color{gray}-0.943 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 51 $$2.57 \mathrm{ms} \pm 12.5 \mathrm{μs}\left({\color{gray}0.085 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 269 $$3.92 \mathrm{ms} \pm 15.6 \mathrm{μs}\left({\color{gray}-0.393 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$2.72 \mathrm{ms} \pm 12.0 \mathrm{μs}\left({\color{gray}-1.549 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 107 $$3.15 \mathrm{ms} \pm 16.8 \mathrm{μs}\left({\color{gray}-0.308 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 133 $$3.33 \mathrm{ms} \pm 17.5 \mathrm{μs}\left({\color{gray}-0.408 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.66 \mathrm{ms} \pm 14.1 \mathrm{μs}\left({\color{gray}-0.314 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 63 $$3.10 \mathrm{ms} \pm 14.7 \mathrm{μs}\left({\color{gray}-0.235 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_none

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 2 $$2.00 \mathrm{ms} \pm 9.51 \mathrm{μs}\left({\color{gray}0.349 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$1.94 \mathrm{ms} \pm 11.0 \mathrm{μs}\left({\color{gray}1.45 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1 $$1.97 \mathrm{ms} \pm 7.41 \mathrm{μs}\left({\color{gray}-1.834 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 8 $$2.19 \mathrm{ms} \pm 12.1 \mathrm{μs}\left({\color{gray}-0.618 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.03 \mathrm{ms} \pm 9.57 \mathrm{μs}\left({\color{gray}0.987 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 3 $$2.18 \mathrm{ms} \pm 8.94 \mathrm{μs}\left({\color{gray}-0.203 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_small

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 52 $$2.30 \mathrm{ms} \pm 12.2 \mathrm{μs}\left({\color{gray}-0.086 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.10 \mathrm{ms} \pm 9.65 \mathrm{μs}\left({\color{gray}-0.286 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 25 $$2.28 \mathrm{ms} \pm 9.49 \mathrm{μs}\left({\color{gray}-0.998 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 94 $$2.59 \mathrm{ms} \pm 13.1 \mathrm{μs}\left({\color{gray}-0.165 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$2.28 \mathrm{ms} \pm 10.8 \mathrm{μs}\left({\color{gray}0.230 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 26 $$2.52 \mathrm{ms} \pm 10.9 \mathrm{μs}\left({\color{gray}-0.788 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 66 $$2.57 \mathrm{ms} \pm 16.8 \mathrm{μs}\left({\color{gray}0.369 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.27 \mathrm{ms} \pm 10.5 \mathrm{μs}\left({\color{gray}-0.152 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 29 $$2.53 \mathrm{ms} \pm 10.9 \mathrm{μs}\left({\color{gray}-0.481 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_complete

Function Value Mean Flame graphs
entity_by_id;one_depth 1 entities $$42.0 \mathrm{ms} \pm 164 \mathrm{μs}\left({\color{gray}-0.331 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 10 entities $$36.0 \mathrm{ms} \pm 165 \mathrm{μs}\left({\color{gray}-0.253 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 25 entities $$39.8 \mathrm{ms} \pm 172 \mathrm{μs}\left({\color{gray}0.568 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 5 entities $$34.9 \mathrm{ms} \pm 145 \mathrm{μs}\left({\color{gray}-0.583 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 50 entities $$48.9 \mathrm{ms} \pm 182 \mathrm{μs}\left({\color{gray}-0.859 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 1 entities $$46.9 \mathrm{ms} \pm 183 \mathrm{μs}\left({\color{gray}-4.310 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 10 entities $$43.0 \mathrm{ms} \pm 157 \mathrm{μs}\left({\color{gray}-2.892 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 25 entities $$74.7 \mathrm{ms} \pm 377 \mathrm{μs}\left({\color{lightgreen}-6.530 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 5 entities $$35.6 \mathrm{ms} \pm 155 \mathrm{μs}\left({\color{lightgreen}-7.231 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 50 entities $$224 \mathrm{ms} \pm 627 \mathrm{μs}\left({\color{gray}-0.260 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 1 entities $$14.8 \mathrm{ms} \pm 111 \mathrm{μs}\left({\color{gray}-3.235 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 10 entities $$15.1 \mathrm{ms} \pm 59.1 \mathrm{μs}\left({\color{lightgreen}-6.512 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 25 entities $$15.5 \mathrm{ms} \pm 76.8 \mathrm{μs}\left({\color{gray}-2.975 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 5 entities $$14.8 \mathrm{ms} \pm 65.9 \mathrm{μs}\left({\color{gray}-3.094 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 50 entities $$19.5 \mathrm{ms} \pm 86.5 \mathrm{μs}\left({\color{gray}-0.989 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_linkless

Function Value Mean Flame graphs
entity_by_id 1 entities $$14.8 \mathrm{ms} \pm 56.5 \mathrm{μs}\left({\color{gray}-4.344 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$14.9 \mathrm{ms} \pm 77.6 \mathrm{μs}\left({\color{gray}-4.071 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$15.0 \mathrm{ms} \pm 108 \mathrm{μs}\left({\color{gray}-3.790 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1000 entities $$15.5 \mathrm{ms} \pm 82.2 \mathrm{μs}\left({\color{gray}-2.996 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$20.3 \mathrm{ms} \pm 114 \mathrm{μs}\left({\color{gray}-1.572 \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 $$26.0 \mathrm{ms} \pm 200 \mathrm{μs}\left({\color{gray}-3.262 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$26.2 \mathrm{ms} \pm 182 \mathrm{μs}\left({\color{gray}-2.724 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 $$27.5 \mathrm{ms} \pm 226 \mathrm{μs}\left({\color{gray}2.17 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$27.5 \mathrm{ms} \pm 202 \mathrm{μs}\left({\color{gray}4.50 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$26.4 \mathrm{ms} \pm 222 \mathrm{μs}\left({\color{gray}1.07 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$27.4 \mathrm{ms} \pm 196 \mathrm{μs}\left({\color{gray}2.10 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$26.6 \mathrm{ms} \pm 209 \mathrm{μs}\left({\color{gray}-0.668 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$26.4 \mathrm{ms} \pm 181 \mathrm{μs}\left({\color{gray}-1.682 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$26.8 \mathrm{ms} \pm 202 \mathrm{μs}\left({\color{gray}0.779 \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 $$6.49 \mathrm{ms} \pm 31.2 \mathrm{μs}\left({\color{gray}-0.547 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
entity_by_property traversal_paths=0 0 $$70.8 \mathrm{ms} \pm 433 \mathrm{μs}\left({\color{gray}-2.131 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=255 1,resolve_depths=inherit:1;values:255;properties:255;links:127;link_dests:126;type:true $$117 \mathrm{ms} \pm 541 \mathrm{μs}\left({\color{gray}3.79 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:0;link_dests:0;type:false $$75.9 \mathrm{ms} \pm 372 \mathrm{μs}\left({\color{gray}-2.808 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:1;link_dests:0;type:true $$84.9 \mathrm{ms} \pm 381 \mathrm{μs}\left({\color{gray}-2.449 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:2;links:1;link_dests:0;type:true $$91.0 \mathrm{ms} \pm 418 \mathrm{μs}\left({\color{gray}1.23 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:2;properties:2;links:1;link_dests:0;type:true $$99.4 \mathrm{ms} \pm 524 \mathrm{μs}\left({\color{gray}2.25 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=0 0 $$79.0 \mathrm{ms} \pm 343 \mathrm{μs}\left({\color{gray}0.710 \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 $$105 \mathrm{ms} \pm 354 \mathrm{μs}\left({\color{gray}3.43 \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 $$85.3 \mathrm{ms} \pm 356 \mathrm{μs}\left({\color{gray}0.648 \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 $$92.9 \mathrm{ms} \pm 336 \mathrm{μs}\left({\color{gray}1.99 \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 $$94.3 \mathrm{ms} \pm 408 \mathrm{μs}\left({\color{gray}1.80 \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 $$95.5 \mathrm{ms} \pm 432 \mathrm{μs}\left({\color{gray}2.33 \mathrm{\%}}\right) $$

scenarios

Function Value Mean Flame graphs
full_test query-limited $$130 \mathrm{ms} \pm 1.87 \mathrm{ms}\left({\color{lightgreen}-9.170 \mathrm{\%}}\right) $$ Flame Graph
full_test query-unlimited $$117 \mathrm{ms} \pm 387 \mathrm{μs}\left({\color{lightgreen}-24.427 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-limited $$30.8 \mathrm{ms} \pm 139 \mathrm{μs}\left({\color{lightgreen}-63.186 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-unlimited $$454 \mathrm{ms} \pm 970 \mathrm{μs}\left({\color{lightgreen}-5.555 \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