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-3334: Stop depending on subgraph when sorting by ontology IDs #5173

Conversation

TimDiekmann
Copy link
Member

🌟 What is the purpose of this PR?

The Subgraph code restricts the VertexIdSorting logic to be locked to the vertices in the graph. To sort ontologies this is not required, we can sort by versioned URL in general. For entities, we don't use that sorting anyway.

🔍 What does this change?

  • Removes VertexIdSorting for Entities
  • Change VertexIdSorting to VersionedUrlSorting for ontologies

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

Copy link
Contributor

Benchmark results

@rust/graph-benches – Integrations

scaling_read_entity_complete_one_depth

Function Value Mean Flame graphs
entity_by_id 10 entities $$51.1 \mathrm{ms} \pm 238 \mathrm{μs}\left({\color{gray}0.443 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 50 entities $$276 \mathrm{ms} \pm 2.52 \mathrm{ms}\left({\color{lightgreen}-82.055 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1 entities $$20.0 \mathrm{ms} \pm 135 \mathrm{μs}\left({\color{gray}1.70 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 25 entities $$74.2 \mathrm{ms} \pm 427 \mathrm{μs}\left({\color{gray}2.22 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 5 entities $$24.7 \mathrm{ms} \pm 110 \mathrm{μs}\left({\color{gray}0.018 \mathrm{\%}}\right) $$ Flame Graph

scaling_read_entity_complete_zero_depth

Function Value Mean Flame graphs
entity_by_id 10 entities $$2.08 \mathrm{ms} \pm 12.0 \mathrm{μs}\left({\color{gray}4.34 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 50 entities $$4.23 \mathrm{ms} \pm 27.8 \mathrm{μs}\left({\color{gray}1.24 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1 entities $$1.89 \mathrm{ms} \pm 12.4 \mathrm{μs}\left({\color{gray}0.804 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 25 entities $$2.74 \mathrm{ms} \pm 73.4 \mathrm{μs}\left({\color{gray}3.67 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 5 entities $$1.92 \mathrm{ms} \pm 11.6 \mathrm{μs}\left({\color{gray}1.39 \mathrm{\%}}\right) $$ Flame Graph

scaling_read_entity_linkless

Function Value Mean Flame graphs
entity_by_id 10 entities $$1.87 \mathrm{ms} \pm 6.80 \mathrm{μs}\left({\color{gray}-1.034 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$2.02 \mathrm{ms} \pm 7.42 \mathrm{μs}\left({\color{gray}0.335 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1000 entities $$2.81 \mathrm{ms} \pm 14.4 \mathrm{μs}\left({\color{lightgreen}-20.376 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1 entities $$1.87 \mathrm{ms} \pm 6.63 \mathrm{μs}\left({\color{gray}1.20 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$13.0 \mathrm{ms} \pm 160 \mathrm{μs}\left({\color{gray}0.487 \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.42 \mathrm{ms} \pm 5.94 \mathrm{μs}\left({\color{gray}1.50 \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 $$16.4 \mathrm{ms} \pm 218 \mathrm{μs}\left({\color{gray}2.79 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$17.1 \mathrm{ms} \pm 227 \mathrm{μs}\left({\color{red}7.46 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$17.6 \mathrm{ms} \pm 246 \mathrm{μs}\left({\color{red}6.35 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$16.9 \mathrm{ms} \pm 252 \mathrm{μs}\left({\color{gray}2.53 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$18.1 \mathrm{ms} \pm 214 \mathrm{μs}\left({\color{red}15.2 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$16.9 \mathrm{ms} \pm 222 \mathrm{μs}\left({\color{gray}3.07 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$17.4 \mathrm{ms} \pm 215 \mathrm{μs}\left({\color{red}6.81 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 $$17.6 \mathrm{ms} \pm 219 \mathrm{μs}\left({\color{lightgreen}-27.862 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$17.0 \mathrm{ms} \pm 234 \mathrm{μs}\left({\color{gray}3.78 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
link_by_source_by_property depths: DT=2, PT=2, ET=2, E=2 $$99.1 \mathrm{ms} \pm 488 \mathrm{μs}\left({\color{gray}-4.393 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=0, E=2 $$80.5 \mathrm{ms} \pm 373 \mathrm{μs}\left({\color{gray}-3.089 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=0, E=0 $$42.2 \mathrm{ms} \pm 306 \mathrm{μs}\left({\color{gray}-3.488 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=2, E=2 $$91.6 \mathrm{ms} \pm 694 \mathrm{μs}\left({\color{gray}-2.192 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=2, ET=2, E=2 $$95.5 \mathrm{ms} \pm 434 \mathrm{μs}\left({\color{gray}-2.246 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=255, PT=255, ET=255, E=255 $$108 \mathrm{ms} \pm 701 \mathrm{μs}\left({\color{gray}-3.408 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=2, PT=2, ET=2, E=2 $$62.3 \mathrm{ms} \pm 421 \mathrm{μs}\left({\color{gray}2.31 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=0, E=2 $$47.6 \mathrm{ms} \pm 235 \mathrm{μs}\left({\color{red}6.50 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=0, E=0 $$43.5 \mathrm{ms} \pm 280 \mathrm{μs}\left({\color{red}8.43 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=2, E=2 $$54.2 \mathrm{ms} \pm 312 \mathrm{μs}\left({\color{gray}3.88 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=2, ET=2, E=2 $$58.5 \mathrm{ms} \pm 359 \mathrm{μs}\left({\color{gray}4.42 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=255, PT=255, ET=255, E=255 $$70.5 \mathrm{ms} \pm 485 \mathrm{μs}\left({\color{gray}1.74 \mathrm{\%}}\right) $$ Flame Graph

@TimDiekmann TimDiekmann added this pull request to the merge queue Sep 23, 2024
Merged via the queue into main with commit 5153241 Sep 23, 2024
83 checks passed
@TimDiekmann TimDiekmann deleted the t/h-3334-stop-depending-on-subgraph-when-sorting-by-ontology-ids branch September 23, 2024 09:37
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 type/eng > backend Owned by the @backend team
Development

Successfully merging this pull request may close these issues.

2 participants