Skip to content

FE-1581: Share the optimizer's Optuna study logic in a pure Python core library - #9514

Draft
kube wants to merge 5 commits into
claude/bottombar-overlap-prevention-3b9d4dfrom
claude/web-optimizer-python-core
Draft

FE-1581: Share the optimizer's Optuna study logic in a pure Python core library#9514
kube wants to merge 5 commits into
claude/bottombar-overlap-prevention-3b9d4dfrom
claude/web-optimizer-python-core

Conversation

@kube

@kube kube commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Before this PR, the optimizer service in apps/petrinaut-opt held the whole Optuna study logic inside PetrinautOptimizer: description checks, sampler construction, parameter suggestion and the study.optimize driver, next to FastAPI, OpenTelemetry and the subprocess bindings. Nothing else could run that study logic. An optimizer that runs where the simulations run, in the browser, would have had to copy it.

This PR moves the study logic into a pure Python library, @local/petrinaut-optimizer-core, and makes the service depend on it. Library builds the seeded study, maps parameter descriptors to suggestions, produces trial events and summaries, and drives a study by ask and tell against an async evaluator. It keeps a study alive across segments so a host can stop it and continue it on the same sampler history, and it keeps several trials in flight when asked. No threads, OS or network calls, so the same modules load under Pyodide. Service behaviour is unchanged.

Links

Changes

Python core library

  • libs/@local/petrinaut-optimizer-core holds the study logic as one module per concept

    description.py parses and checks a describe result, study.py builds the study and suggests values, ask_tell.py runs a study against an async evaluator, pyodide_entry.py adapts JavaScript callbacks.

  • parse_description accepts the CLI's optimization.describe JSON and enforces the service's rules with the same messages

    Sampler set, trial cap, seed sign, duplicate identifiers, finite bounds, log-scale domains and integer log steps.

  • run_study asks, awaits the evaluator, tells, and reports each trial with the running best

    An evaluator result of {"objective": x} completes the trial, {"pruned": reason} prunes it, a non-finite objective raises.
    Cancellation is read before each ask and after each evaluate.

  • run_study continues a study and keeps several trials in flight

    trials overrides the description's count and continues the same study, so numbering and sampler history carry on.
    Up to parallelism trials run as asyncio tasks and are told in completion order.
    Summary counts are cumulative over the study.

  • Stop tells the trials in flight as failed

    No trial stays in Optuna's running state, so a continued study samples from told trials only.

  • create_study scales the TPE sampler's random start-up to the study

    Optuna's default of 10 random trials is most of a short study, so no step was ever proposed from results.
    The start-up is now a third of the requested trials, at least 2 and at most 10; an explicit n_startup_trials still wins.

  • create_study turns on the constant-liar TPE when a study runs trials in parallel

    Pending trials count as the worst value seen while their evaluation is out, so parallel asks spread instead of repeating.

  • Browser entry keeps a study handle across calls

    create_browser_study builds the study once and returns a StudyHandle.
    run_browser_study runs one segment of trials on the handle and adds them to handle.requested.
    release_browser_study drops the study.
    A stopped segment drops its untold remainder from handle.requested, so a stop at 4 of 8 followed by 4 more reads 8 of 8.

  • runtime-lock.json pins the Pyodide, Python, Optuna and colorlog versions the browser installs

    A test asserts the pinned Optuna and colorlog versions match the library's own lockfile.

Service

  • PetrinautOptimizer delegates description parsing, study creation and suggestion to the core library

    Its threaded study.optimize driver, trial frames, event pump and telemetry stay as they were.

  • Service dependency on petrinaut-optimizer-core as an editable path source; Optuna bound to >=4.9,<5

    Dockerfile copies the library before uv sync, the deploy workflow's image path filter includes it, turbo codegen inputs include its sources.

Architecture

  • New layer optimizer-core declared on the package and registered in the architecture config
  • apps/petrinaut-opt README and AGENTS name the shared library

Test coverage

  • libs/@local/petrinaut-optimizer-core/tests:

    Each description rule, suggest mapping per parameter type, seeded determinism, trial event and summary shapes, ask and tell with objectives, pruned outcomes, non-finite rejection, cancellation at both checkpoints, and lockfile parity.

  • tests/test_ask_tell.py continuation and parallelism:

    Parallelism 1 gives the same sequence as a plain ask and tell loop.
    A 10-trial study continued by 5 equals a 15-trial study, while a restart repeats the sampler's start-up draws.
    Parallel asks run ahead and are told in completion order, a stop tells the trials in flight as failed and a continuation carries their count, an evaluator error cancels the other tasks.

  • tests/test_study.py start-up trials:

    The scaled count per study size, an explicit count winning, the random sampler untouched, and a 6-trial TPE study whose third proposal depends on the objectives told.

  • tests/test_pyodide_entry.py:

    Continued numbering and cumulative counts on one handle, stop then continue, release, one segment at a time, trial cap across segments, parallelism reaching the sampler, proxy unwrapping, description and outcome rejection.

  • apps/petrinaut-opt/tests:

    Existing service suite; the moved suggest and determinism tests now live in the library.

How to test

  • cd libs/@local/petrinaut-optimizer-core && uv sync && uv run pytest
  • cd apps/petrinaut-opt && uv sync && uv run pytest

    Expect both suites green and openapi/openapi.json unchanged after yarn codegen

@vercel

vercel Bot commented Sep 3, 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 4, 2026 12:38pm UTC
petrinaut Ready Ready Preview Sep 4, 2026 12:38pm UTC
petrinaut-docs Ready Ready Preview Sep 4, 2026 12:38pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
hashdotdesign-tokens Ignored Ignored Preview Sep 4, 2026 12:38pm UTC

Request Review

@github-actions github-actions Bot added area/deps Relates to third-party dependencies (area) area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > backend Owned by the @backend team area/tests New or updated tests area/apps type/legal Owned by the @legal team labels Sep 3, 2026
@kube kube self-assigned this Sep 3, 2026
@codecov

codecov Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.89%. Comparing base (eea4e1f) to head (bb07d4e).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9514   +/-   ##
=======================================
  Coverage   60.89%   60.89%           
=======================================
  Files        1461     1461           
  Lines      146725   146725           
  Branches     6744     6744           
=======================================
+ Hits        89343    89344    +1     
+ Misses      56264    56263    -1     
  Partials     1118     1118           
Flag Coverage Δ
apps.hash-ai-worker-ts 1.99% <ø> (ø)
apps.hash-api 15.41% <ø> (ø)
apps.hash-graph 13.32% <ø> (ø)
blockprotocol.type-system 38.15% <ø> (ø)
local.claude-hooks 0.00% <ø> (ø)
local.harpc-client 51.49% <ø> (ø)
local.hash-backend-utils 3.27% <ø> (ø)
local.hash-graph-sdk 10.02% <ø> (ø)
local.hash-isomorphic-utils 12.22% <ø> (ø)
rust.antsi 2.36% <ø> (ø)
rust.error-stack 90.81% <ø> (ø)
rust.harpc-codec 84.70% <ø> (ø)
rust.harpc-net 96.23% <ø> (+0.01%) ⬆️
rust.harpc-tower 67.03% <ø> (ø)
rust.harpc-types 0.00% <ø> (ø)
rust.harpc-wire-protocol 92.23% <ø> (ø)
rust.hash-codec 72.76% <ø> (ø)
rust.hash-config 74.74% <ø> (ø)
rust.hash-graph-api 19.71% <ø> (ø)
rust.hash-graph-authorization 63.14% <ø> (ø)
rust.hash-graph-embeddings 91.88% <ø> (ø)
rust.hash-graph-postgres-store 32.15% <ø> (ø)
rust.hash-graph-store 48.41% <ø> (ø)
rust.hash-graph-temporal-versioning 50.18% <ø> (ø)
rust.hash-graph-types 0.00% <ø> (ø)
rust.hash-graph-validation 84.71% <ø> (ø)
rust.hash-middleware 90.92% <ø> (ø)
rust.hashql-ast 89.63% <ø> (ø)
rust.hashql-compiletest 28.39% <ø> (ø)
rust.hashql-core 78.95% <ø> (ø)
rust.hashql-diagnostics 72.51% <ø> (ø)
rust.hashql-eval 79.82% <ø> (ø)
rust.hashql-hir 89.09% <ø> (ø)
rust.hashql-mir 87.92% <ø> (ø)
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.

@codspeed-hq

codspeed-hq Bot commented Sep 3, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 98 untouched benchmarks


Comparing claude/web-optimizer-python-core (2fa8ad3) with main (4854d5f)1

Open in CodSpeed

Footnotes

  1. No successful run was found on claude/bottombar-overlap-prevention-3b9d4d (68924cd) during the generation of this report, so main (4854d5f) was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@kube
kube force-pushed the claude/web-optimizer-python-core branch from e11f1d1 to 99d0b1a Compare September 3, 2026 22:23
@kube
kube deployed to pull-request September 3, 2026 22:24 — with GitHub Actions Active
@kube
kube deployed to pull-request September 3, 2026 22:24 — with GitHub Actions Active
@kube kube changed the title Share the optimizer's Optuna study logic in a pure Python core library FE-1581: Share the optimizer's Optuna study logic in a pure Python core library Sep 4, 2026
@kube
kube deployed to pull-request September 4, 2026 04:37 — with GitHub Actions Active
@kube
kube deployed to pull-request September 4, 2026 04:37 — with GitHub Actions Active
@kube
kube deployed to pull-request September 4, 2026 04:54 — with GitHub Actions Active
@kube
kube deployed to pull-request September 4, 2026 04:54 — with GitHub Actions Active
@github-actions

github-actions Bot commented Sep 4, 2026

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 $$18.3 \mathrm{ms} \pm 130 \mathrm{μs}\left({\color{gray}-2.099 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.12 \mathrm{ms} \pm 11.8 \mathrm{μs}\left({\color{gray}-2.366 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1002 $$8.47 \mathrm{ms} \pm 57.2 \mathrm{μs}\left({\color{gray}-1.856 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 3314 $$27.7 \mathrm{ms} \pm 219 \mathrm{μs}\left({\color{gray}1.04 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$8.22 \mathrm{ms} \pm 57.4 \mathrm{μs}\left({\color{gray}-4.057 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 1527 $$15.4 \mathrm{ms} \pm 120 \mathrm{μs}\left({\color{gray}-1.168 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 2078 $$19.1 \mathrm{ms} \pm 124 \mathrm{μs}\left({\color{lightgreen}-8.053 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.35 \mathrm{ms} \pm 14.3 \mathrm{μs}\left({\color{gray}-0.648 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 1033 $$9.15 \mathrm{ms} \pm 56.3 \mathrm{μs}\left({\color{lightgreen}-5.563 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_medium

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 102 $$2.46 \mathrm{ms} \pm 22.6 \mathrm{μs}\left({\color{red}5.22 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$1.92 \mathrm{ms} \pm 9.30 \mathrm{μs}\left({\color{gray}-0.573 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 52 $$2.18 \mathrm{ms} \pm 17.6 \mathrm{μs}\left({\color{gray}3.34 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 269 $$3.35 \mathrm{ms} \pm 27.8 \mathrm{μs}\left({\color{gray}3.15 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$2.28 \mathrm{ms} \pm 15.3 \mathrm{μs}\left({\color{gray}2.01 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 108 $$2.66 \mathrm{ms} \pm 19.8 \mathrm{μs}\left({\color{gray}1.21 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 133 $$3.00 \mathrm{ms} \pm 25.9 \mathrm{μs}\left({\color{red}6.89 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.19 \mathrm{ms} \pm 12.2 \mathrm{μs}\left({\color{gray}0.818 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 63 $$2.65 \mathrm{ms} \pm 18.9 \mathrm{μs}\left({\color{gray}3.75 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_none

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 2 $$1.76 \mathrm{ms} \pm 14.3 \mathrm{μs}\left({\color{gray}4.81 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$1.70 \mathrm{ms} \pm 6.55 \mathrm{μs}\left({\color{gray}0.488 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 2 $$1.76 \mathrm{ms} \pm 9.08 \mathrm{μs}\left({\color{gray}1.12 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 8 $$1.93 \mathrm{ms} \pm 12.0 \mathrm{μs}\left({\color{gray}1.36 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$1.82 \mathrm{ms} \pm 10.9 \mathrm{μs}\left({\color{gray}2.53 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 3 $$2.01 \mathrm{ms} \pm 13.2 \mathrm{μs}\left({\color{gray}1.30 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_small

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 52 $$1.95 \mathrm{ms} \pm 14.0 \mathrm{μs}\left({\color{gray}-1.456 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$1.75 \mathrm{ms} \pm 8.81 \mathrm{μs}\left({\color{gray}-2.951 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 26 $$1.89 \mathrm{ms} \pm 15.7 \mathrm{μs}\left({\color{gray}0.760 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 94 $$2.17 \mathrm{ms} \pm 14.8 \mathrm{μs}\left({\color{gray}-3.664 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$1.90 \mathrm{ms} \pm 14.8 \mathrm{μs}\left({\color{gray}-1.588 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 27 $$2.04 \mathrm{ms} \pm 14.4 \mathrm{μs}\left({\color{gray}-2.268 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 66 $$2.18 \mathrm{ms} \pm 14.0 \mathrm{μs}\left({\color{gray}0.908 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$1.95 \mathrm{ms} \pm 19.8 \mathrm{μs}\left({\color{gray}0.303 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 29 $$2.08 \mathrm{ms} \pm 15.1 \mathrm{μs}\left({\color{gray}-0.360 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_complete

Function Value Mean Flame graphs
entity_by_id;one_depth 1 entities $$21.2 \mathrm{ms} \pm 125 \mathrm{μs}\left({\color{gray}-1.924 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 10 entities $$46.5 \mathrm{ms} \pm 246 \mathrm{μs}\left({\color{gray}-0.805 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 25 entities $$23.1 \mathrm{ms} \pm 114 \mathrm{μs}\left({\color{gray}0.104 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 5 entities $$27.0 \mathrm{ms} \pm 185 \mathrm{μs}\left({\color{gray}-0.450 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 50 entities $$28.1 \mathrm{ms} \pm 204 \mathrm{μs}\left({\color{gray}3.08 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 1 entities $$23.3 \mathrm{ms} \pm 134 \mathrm{μs}\left({\color{gray}2.99 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 10 entities $$279 \mathrm{ms} \pm 906 \mathrm{μs}\left({\color{gray}2.26 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 25 entities $$60.1 \mathrm{ms} \pm 343 \mathrm{μs}\left({\color{gray}4.22 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 5 entities $$59.6 \mathrm{ms} \pm 319 \mathrm{μs}\left({\color{gray}4.83 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 50 entities $$198 \mathrm{ms} \pm 892 \mathrm{μs}\left({\color{red}12.7 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 1 entities $$6.89 \mathrm{ms} \pm 48.1 \mathrm{μs}\left({\color{gray}3.48 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 10 entities $$7.02 \mathrm{ms} \pm 41.3 \mathrm{μs}\left({\color{gray}3.00 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 25 entities $$7.24 \mathrm{ms} \pm 50.7 \mathrm{μs}\left({\color{red}5.19 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 5 entities $$6.93 \mathrm{ms} \pm 40.1 \mathrm{μs}\left({\color{gray}2.66 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 50 entities $$7.21 \mathrm{ms} \pm 43.0 \mathrm{μs}\left({\color{red}5.67 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_linkless

Function Value Mean Flame graphs
entity_by_id 1 entities $$7.31 \mathrm{ms} \pm 52.7 \mathrm{μs}\left({\color{red}7.36 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$7.19 \mathrm{ms} \pm 51.7 \mathrm{μs}\left({\color{red}7.60 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$7.25 \mathrm{ms} \pm 52.0 \mathrm{μs}\left({\color{red}7.44 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1000 entities $$7.58 \mathrm{ms} \pm 54.1 \mathrm{μs}\left({\color{red}11.3 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$7.64 \mathrm{ms} \pm 59.1 \mathrm{μs}\left({\color{gray}3.77 \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 $$7.14 \mathrm{ms} \pm 34.8 \mathrm{μs}\left({\color{gray}1.28 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$7.38 \mathrm{ms} \pm 48.0 \mathrm{μs}\left({\color{gray}4.42 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 $$7.46 \mathrm{ms} \pm 43.2 \mathrm{μs}\left({\color{red}5.17 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$7.43 \mathrm{ms} \pm 48.3 \mathrm{μs}\left({\color{gray}4.57 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$7.39 \mathrm{ms} \pm 42.6 \mathrm{μs}\left({\color{gray}4.95 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$7.54 \mathrm{ms} \pm 46.6 \mathrm{μs}\left({\color{red}7.59 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$7.15 \mathrm{ms} \pm 42.3 \mathrm{μs}\left({\color{gray}1.35 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$7.23 \mathrm{ms} \pm 44.4 \mathrm{μs}\left({\color{gray}1.73 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$7.29 \mathrm{ms} \pm 39.4 \mathrm{μs}\left({\color{gray}4.67 \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 $$5.46 \mathrm{ms} \pm 36.1 \mathrm{μs}\left({\color{red}7.45 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
entity_by_property traversal_paths=0 0 $$46.4 \mathrm{ms} \pm 212 \mathrm{μs}\left({\color{red}11.8 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=255 1,resolve_depths=inherit:1;values:255;properties:255;links:127;link_dests:126;type:true $$85.4 \mathrm{ms} \pm 464 \mathrm{μs}\left({\color{red}14.4 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:0;link_dests:0;type:false $$50.4 \mathrm{ms} \pm 212 \mathrm{μs}\left({\color{red}8.44 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:1;link_dests:0;type:true $$58.0 \mathrm{ms} \pm 347 \mathrm{μs}\left({\color{red}10.0 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:2;links:1;link_dests:0;type:true $$65.4 \mathrm{ms} \pm 300 \mathrm{μs}\left({\color{red}8.72 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:2;properties:2;links:1;link_dests:0;type:true $$70.3 \mathrm{ms} \pm 786 \mathrm{μs}\left({\color{red}10.4 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=0 0 $$36.4 \mathrm{ms} \pm 276 \mathrm{μs}\left({\color{red}26.1 \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 $$53.4 \mathrm{ms} \pm 388 \mathrm{μs}\left({\color{red}9.03 \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 $$41.5 \mathrm{ms} \pm 270 \mathrm{μs}\left({\color{red}21.4 \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 $$47.3 \mathrm{ms} \pm 270 \mathrm{μs}\left({\color{red}16.7 \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 $$48.2 \mathrm{ms} \pm 293 \mathrm{μs}\left({\color{red}12.9 \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 $$46.9 \mathrm{ms} \pm 357 \mathrm{μs}\left({\color{red}8.82 \mathrm{\%}}\right) $$

scenarios

Function Value Mean Flame graphs
full_test query-limited $$79.7 \mathrm{ms} \pm 413 \mathrm{μs}\left({\color{gray}-4.451 \mathrm{\%}}\right) $$ Flame Graph
full_test query-unlimited $$95.9 \mathrm{ms} \pm 4.95 \mathrm{ms}\left({\color{red}8.09 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-limited $$14.7 \mathrm{ms} \pm 104 \mathrm{μs}\left({\color{gray}0.077 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-unlimited $$368 \mathrm{ms} \pm 1.39 \mathrm{ms}\left({\color{gray}2.53 \mathrm{\%}}\right) $$ Flame Graph

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps area/deps Relates to third-party dependencies (area) area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) area/tests New or updated tests type/eng > backend Owned by the @backend team type/legal Owned by the @legal team

Development

Successfully merging this pull request may close these issues.

1 participant