Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

H-3424: Move ontology UUID identifier to typesystem #5372

Merged
merged 6 commits into from
Oct 14, 2024

Conversation

TimDiekmann
Copy link
Member

🌟 What is the purpose of this PR?

To resolve types we need the UUID-based identifier to match the representation in the database. This also safes a lot of time when comparing the UUIDs in comparison to a full-string comparison.
We did this already for DataTypeId, but the other IDs were not moved, yet.

🚫 Blocked by

🔍 What does this change?

  • Rename DataTypeId to DataTypeUuid
  • Move PropertyTypeId to type_system::schema::PropertyTypeUuid
  • Move EntityTypeId to type_system::schema::EntityTypeUuid
  • Move OntologyId to type_system::schema::OntologyTypeUuid
  • Add documentation for all of them do describe what they are

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

CiaranMn
CiaranMn previously approved these changes Oct 11, 2024
Base automatically changed from t/h-3421-resolve-closed-data-types-on-creationupdating to main October 11, 2024 15:51
@TimDiekmann TimDiekmann dismissed CiaranMn’s stale review October 11, 2024 15:51

The base branch was changed.

CiaranMn
CiaranMn previously approved these changes Oct 12, 2024
…ds-to-typesystem

# Conflicts:
#	libs/@blockprotocol/type-system/rust/src/schema/mod.rs
CiaranMn
CiaranMn previously approved these changes Oct 12, 2024
Copy link
Contributor

Benchmark results

@rust/graph-benches – Integrations

representative_read_entity

Function Value Mean Flame graphs
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 $$16.1 \mathrm{ms} \pm 154 \mathrm{μs}\left({\color{lightgreen}-19.426 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$15.8 \mathrm{ms} \pm 161 \mathrm{μs}\left({\color{gray}-1.919 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/block/v/1 $$17.3 \mathrm{ms} \pm 173 \mathrm{μs}\left({\color{gray}3.25 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$16.4 \mathrm{ms} \pm 159 \mathrm{μs}\left({\color{lightgreen}-31.783 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$16.4 \mathrm{ms} \pm 190 \mathrm{μs}\left({\color{red}5.52 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$15.9 \mathrm{ms} \pm 157 \mathrm{μs}\left({\color{gray}1.21 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$15.2 \mathrm{ms} \pm 160 \mathrm{μs}\left({\color{gray}-4.262 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$15.7 \mathrm{ms} \pm 162 \mathrm{μs}\left({\color{gray}4.00 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$15.9 \mathrm{ms} \pm 195 \mathrm{μs}\left({\color{gray}1.75 \mathrm{\%}}\right) $$ Flame Graph

representative_read_entity_type

Function Value Mean Flame graphs
get_entity_type_by_id Account ID: d4e16033-c281-4cde-aa35-9085bf2e7579 $$1.41 \mathrm{ms} \pm 4.77 \mathrm{μs}\left({\color{gray}0.393 \mathrm{\%}}\right) $$ Flame Graph

scaling_read_entity_complete_zero_depth

Function Value Mean Flame graphs
entity_by_id 50 entities $$4.04 \mathrm{ms} \pm 21.0 \mathrm{μs}\left({\color{gray}-0.495 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$2.11 \mathrm{ms} \pm 15.8 \mathrm{μs}\left({\color{gray}1.69 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 25 entities $$2.71 \mathrm{ms} \pm 87.7 \mathrm{μs}\left({\color{lightgreen}-11.045 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1 entities $$1.86 \mathrm{ms} \pm 7.62 \mathrm{μs}\left({\color{gray}0.639 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 5 entities $$1.90 \mathrm{ms} \pm 8.85 \mathrm{μs}\left({\color{gray}0.784 \mathrm{\%}}\right) $$ Flame Graph

scaling_read_entity_linkless

Function Value Mean Flame graphs
entity_by_id 1000 entities $$2.74 \mathrm{ms} \pm 11.1 \mathrm{μs}\left({\color{gray}-0.362 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$2.03 \mathrm{ms} \pm 6.88 \mathrm{μs}\left({\color{gray}-0.549 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$1.86 \mathrm{ms} \pm 7.08 \mathrm{μs}\left({\color{gray}-1.616 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$9.27 \mathrm{ms} \pm 154 \mathrm{μs}\left({\color{lightgreen}-25.473 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1 entities $$1.87 \mathrm{ms} \pm 5.56 \mathrm{μs}\left({\color{gray}-1.221 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
entity_by_property depths: DT=2, PT=2, ET=2, E=2 $$58.7 \mathrm{ms} \pm 273 \mathrm{μs}\left({\color{gray}-0.948 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=255, PT=255, ET=255, E=255 $$68.5 \mathrm{ms} \pm 453 \mathrm{μs}\left({\color{gray}-0.180 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=0, E=0 $$39.7 \mathrm{ms} \pm 534 \mathrm{μs}\left({\color{gray}-0.337 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=0, E=2 $$43.5 \mathrm{ms} \pm 345 \mathrm{μs}\left({\color{gray}0.147 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=2, ET=2, E=2 $$54.8 \mathrm{ms} \pm 219 \mathrm{μs}\left({\color{gray}0.359 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=2, E=2 $$50.2 \mathrm{ms} \pm 230 \mathrm{μs}\left({\color{gray}-0.641 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=2, PT=2, ET=2, E=2 $$98.7 \mathrm{ms} \pm 396 \mathrm{μs}\left({\color{gray}-0.131 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=255, PT=255, ET=255, E=255 $$108 \mathrm{ms} \pm 723 \mathrm{μs}\left({\color{gray}0.265 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=0, E=0 $$43.1 \mathrm{ms} \pm 307 \mathrm{μs}\left({\color{gray}1.51 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=0, E=2 $$81.8 \mathrm{ms} \pm 491 \mathrm{μs}\left({\color{gray}2.76 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=2, ET=2, E=2 $$94.8 \mathrm{ms} \pm 568 \mathrm{μs}\left({\color{gray}-0.407 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=2, E=2 $$91.7 \mathrm{ms} \pm 561 \mathrm{μs}\left({\color{gray}-0.520 \mathrm{\%}}\right) $$ Flame Graph

scaling_read_entity_complete_one_depth

Function Value Mean Flame graphs
entity_by_id 50 entities $$273 \mathrm{ms} \pm 1.91 \mathrm{ms}\left({\color{lightgreen}-33.119 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$31.3 \mathrm{ms} \pm 120 \mathrm{μs}\left({\color{gray}-3.813 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 25 entities $$73.3 \mathrm{ms} \pm 439 \mathrm{μs}\left({\color{gray}-2.759 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1 entities $$19.9 \mathrm{ms} \pm 112 \mathrm{μs}\left({\color{gray}-0.906 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 5 entities $$24.9 \mathrm{ms} \pm 234 \mathrm{μs}\left({\color{gray}0.894 \mathrm{\%}}\right) $$ Flame Graph

@TimDiekmann TimDiekmann added this pull request to the merge queue Oct 14, 2024
Merged via the queue into main with commit 8ff54be Oct 14, 2024
101 of 102 checks passed
@TimDiekmann TimDiekmann deleted the t/h-3424-move-uuid-based-schema-ids-to-typesystem branch October 14, 2024 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/apps > hash* Affects HASH (a `hash-*` app) area/apps > hash-graph area/apps area/libs Relates to first-party libraries/crates/packages (area) area/tests > integration New or updated integration tests 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