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

fix: make printer for query generation more efficient #27

Merged
merged 1 commit into from
Aug 30, 2023

Conversation

sorawee
Copy link

@sorawee sorawee commented Aug 30, 2023

We should avoid building the resulting query string with format repeatedly, because format creates an entirely new string in each invocation. When the query is big, the cost is prohibitively expensive.

This commit instead builds the query string by writing to a string port directly (similar to the StringBuilder idiom in languages like Java). As the fix needs to be done on Z3, cvc4, and cvc5, I also take an opportunity to refactor them to reduce code redundancy.

We should avoid building the resulting query string with `format`
repeatedly, because `format` creates an entirely new string in
each invocation. When the query is big, the cost is
prohibitively expensive.

This commit instead builds the query string by writing to a
string port directly (similar to the StringBuilder idiom in languages
like Java). As the fix needs to be done on Z3, cvc4, and cvc5, I also
take an opportunity to refactor them to reduce code redundancy.
Copy link
Collaborator

@shankarapailoor shankarapailoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sorawee sorawee merged commit 37605c0 into Veridise:main Aug 30, 2023
@sorawee sorawee deleted the fix-printer branch August 30, 2023 21:42
sorawee added a commit that referenced this pull request Jan 31, 2024
* chore: clean up indentation

* logging: log inferred known vars
sorawee added a commit to sorawee/Picus that referenced this pull request Mar 8, 2024
* chore: clean up indentation

* logging: log inferred known vars
sorawee added a commit that referenced this pull request Mar 13, 2024
* chore: clean up indentation

* logging: log inferred known vars
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.

2 participants