Skip to content

Optimize usages of SqlString.Append #2166

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

Merged
merged 6 commits into from
Jul 12, 2019
Merged

Conversation

bahusoid
Copy link
Member

Each SqlString.Append call leads to new SqlString creation. And called SqlString ctor doesn't look lightweight to me. So let's minimize subsequent Append calls.

Copy link
Contributor

@ggeurts ggeurts left a comment

Choose a reason for hiding this comment

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

The Append operations would be best served with an additional SqlString constructor

return new SqlString(this, text);
}

public SqlString Append(params object[] parts)
Copy link
Contributor

Choose a reason for hiding this comment

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

I would consider introducing a new private SqlString(SqlString other, params object[] parts) constructor which can optimise the parts copying and append operations.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually I've considered such ctor. But looking at existing ctors SqlString(SqlString x) and SqlString(params object[] parts) - I didn't find a way to merge them nicely. So IMHO it's not worth it. But if you've come up with implementation - feel free to add it.

@hazzik hazzik added this to the 5.3 milestone Jul 12, 2019
@hazzik hazzik merged commit 3041c49 into nhibernate:master Jul 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants