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

Use Arc of adapter to execute queries. #286

Merged
merged 2 commits into from
May 16, 2023
Merged

Use Arc of adapter to execute queries. #286

merged 2 commits into from
May 16, 2023

Conversation

obi1kenobi
Copy link
Owner

Using trustfall in a web server was previously quite tricky because it required an Rc<Adapter> whereas servers tend to wrap everything inside Arc. The mismatch was even more striking since some of Trustfall's other input arguments were themselves wrapped in Arc.

In principle, Trustfall doesn't need to know whether it's passed an Rc or Arc of the adapter. There's a way to do this with generics, but it's a bit complex and the overhead is not worth it right now. Instead, we make evaluating queries always use an Arc to get a large usability and ergonomics win at a tiny perf cost. We can relatively easily win back more than enough performance by optimizing other things. Stay tuned!

@obi1kenobi obi1kenobi enabled auto-merge (squash) May 16, 2023 17:23
@obi1kenobi obi1kenobi merged commit 30d3d64 into main May 16, 2023
11 checks passed
@obi1kenobi obi1kenobi deleted the use_arc_adapter branch May 16, 2023 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant