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-3430: Implement folding for anyOf constraints #5404

Merged
merged 2 commits into from
Oct 18, 2024

Conversation

TimDiekmann
Copy link
Member

🌟 What is the purpose of this PR?

This adds the combine functionality for anyOfs.

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

⚠️ Known issues

Due to the mutable nature of combine there is quite some duplication as the lhs and rhs typically cannot be swapped simply. This probably requires some changes to H-3426

🛡 What tests cover this?

Various test cases were added. Also, previous tests were adjusted to take the new changes into account.

CiaranMn
CiaranMn previously approved these changes Oct 17, 2024
@TimDiekmann TimDiekmann force-pushed the t/h-3427-implement-folding-for-number-constraints branch from 161a08a to c54b994 Compare October 17, 2024 20:53
Base automatically changed from t/h-3427-implement-folding-for-number-constraints to main October 17, 2024 22:11
@TimDiekmann TimDiekmann dismissed CiaranMn’s stale review October 17, 2024 22:11

The base branch was changed.

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/block/v/1 $$17.2 \mathrm{ms} \pm 205 \mathrm{μs}\left({\color{lightgreen}-29.282 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$16.7 \mathrm{ms} \pm 209 \mathrm{μs}\left({\color{gray}1.61 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$15.8 \mathrm{ms} \pm 193 \mathrm{μs}\left({\color{lightgreen}-33.546 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$16.2 \mathrm{ms} \pm 154 \mathrm{μs}\left({\color{lightgreen}-30.056 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$16.7 \mathrm{ms} \pm 168 \mathrm{μs}\left({\color{gray}2.56 \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 163 \mathrm{μs}\left({\color{gray}-2.248 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 $$15.0 \mathrm{ms} \pm 198 \mathrm{μs}\left({\color{lightgreen}-7.729 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$16.3 \mathrm{ms} \pm 175 \mathrm{μs}\left({\color{gray}3.64 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$16.6 \mathrm{ms} \pm 158 \mathrm{μs}\left({\color{gray}2.38 \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.40 \mathrm{ms} \pm 4.55 \mathrm{μs}\left({\color{gray}0.606 \mathrm{\%}}\right) $$ Flame Graph

scaling_read_entity_complete_zero_depth

Function Value Mean Flame graphs
entity_by_id 50 entities $$4.00 \mathrm{ms} \pm 29.3 \mathrm{μs}\left({\color{gray}2.36 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$2.05 \mathrm{ms} \pm 7.24 \mathrm{μs}\left({\color{gray}0.386 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 25 entities $$2.70 \mathrm{ms} \pm 69.0 \mathrm{μs}\left({\color{lightgreen}-6.100 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1 entities $$1.84 \mathrm{ms} \pm 10.0 \mathrm{μs}\left({\color{gray}0.417 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 5 entities $$1.88 \mathrm{ms} \pm 12.7 \mathrm{μs}\left({\color{gray}0.582 \mathrm{\%}}\right) $$ Flame Graph

scaling_read_entity_linkless

Function Value Mean Flame graphs
entity_by_id 1000 entities $$2.76 \mathrm{ms} \pm 11.4 \mathrm{μs}\left({\color{lightgreen}-5.180 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$2.02 \mathrm{ms} \pm 5.32 \mathrm{μs}\left({\color{gray}2.09 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$1.85 \mathrm{ms} \pm 6.04 \mathrm{μs}\left({\color{gray}0.774 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$9.33 \mathrm{ms} \pm 132 \mathrm{μs}\left({\color{red}6.27 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1 entities $$1.87 \mathrm{ms} \pm 6.69 \mathrm{μs}\left({\color{gray}-0.795 \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.3 \mathrm{ms} \pm 330 \mathrm{μs}\left({\color{gray}2.55 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=255, PT=255, ET=255, E=255 $$67.4 \mathrm{ms} \pm 326 \mathrm{μs}\left({\color{gray}2.85 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=0, E=0 $$39.8 \mathrm{ms} \pm 232 \mathrm{μs}\left({\color{gray}4.96 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=0, E=2 $$43.3 \mathrm{ms} \pm 318 \mathrm{μs}\left({\color{gray}4.21 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=2, ET=2, E=2 $$53.8 \mathrm{ms} \pm 271 \mathrm{μs}\left({\color{gray}2.68 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=2, E=2 $$50.0 \mathrm{ms} \pm 287 \mathrm{μs}\left({\color{gray}3.77 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=2, PT=2, ET=2, E=2 $$97.9 \mathrm{ms} \pm 720 \mathrm{μs}\left({\color{gray}1.87 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=255, PT=255, ET=255, E=255 $$106 \mathrm{ms} \pm 575 \mathrm{μs}\left({\color{gray}1.11 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=0, E=0 $$41.7 \mathrm{ms} \pm 240 \mathrm{μs}\left({\color{gray}3.02 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=0, E=2 $$79.1 \mathrm{ms} \pm 442 \mathrm{μs}\left({\color{gray}2.36 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=2, ET=2, E=2 $$93.2 \mathrm{ms} \pm 384 \mathrm{μs}\left({\color{gray}1.51 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=2, E=2 $$88.7 \mathrm{ms} \pm 294 \mathrm{μs}\left({\color{gray}0.956 \mathrm{\%}}\right) $$ Flame Graph

scaling_read_entity_complete_one_depth

Function Value Mean Flame graphs
entity_by_id 50 entities $$269 \mathrm{ms} \pm 1.77 \mathrm{ms}\left({\color{gray}1.90 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$51.0 \mathrm{ms} \pm 285 \mathrm{μs}\left({\color{red}24.4 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 25 entities $$73.5 \mathrm{ms} \pm 526 \mathrm{μs}\left({\color{gray}0.936 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1 entities $$19.8 \mathrm{ms} \pm 78.1 \mathrm{μs}\left({\color{gray}1.24 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 5 entities $$25.1 \mathrm{ms} \pm 192 \mathrm{μs}\left({\color{gray}3.05 \mathrm{\%}}\right) $$ Flame Graph

@TimDiekmann TimDiekmann added this pull request to the merge queue Oct 18, 2024
Merged via the queue into main with commit 3842c47 Oct 18, 2024
101 of 102 checks passed
@TimDiekmann TimDiekmann deleted the t/h-3430-implement-folding-for-anyof-constraints branch October 18, 2024 09:31
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)
Development

Successfully merging this pull request may close these issues.

2 participants