[SQLite] Bump and use byte[] variants added to blob_open for performance#25047
[SQLite] Bump and use byte[] variants added to blob_open for performance#25047jasonmalinowski merged 6 commits intodotnet:masterfrom
Conversation
|
I went with the route of adding another property ( |
There was a problem hiding this comment.
there is Util.ToUtf8 and Util.to_utf8?
There was a problem hiding this comment.
does this overload need to exist? who is calling into ReadBlob with a string for the table name or column name?
There was a problem hiding this comment.
Well, it was public API, so not sure if it's safe to completely remove it (although the class is internal).
There was a problem hiding this comment.
I can remove this overload if we don't need it (it's currently not used anywhere)
There was a problem hiding this comment.
Yes. Please remove the overload. This type is completely internal to roslyn. We do not have to worry about breaking changes here.
There was a problem hiding this comment.
shouldn't the ColumnName be a byte[] too?
There was a problem hiding this comment.
Yep, good catches so far. I haven't compiled locally, so this probably has issues even at compile time :p
8812e66 to
fdf4f0c
Compare
There was a problem hiding this comment.
@CyrusNajmabadi had forgotten to commit this file.
There was a problem hiding this comment.
this should be documented why you're doing this (i presume sqlite requires 0 terminated utf8?).
There was a problem hiding this comment.
This was shamelessly copy pasted from sqlitepcl.raw :p
There was a problem hiding this comment.
Just to be clear. By 'documented', i meant: 'comment in the code' :)
There was a problem hiding this comment.
Yes, I did add some comments.
There was a problem hiding this comment.
💭 This method could be reduced to the following if you want it simple. You may end up with a couple extra NUL characters in the converted string, but it would be usable.
return Encoding.UTF8.GetBytes(text + '\0');
There was a problem hiding this comment.
Encoding.UTF8.GetBytes(string) internally calls the byte[] variant, https://github.com/dotnet/corefx/blob/master/src/Common/src/CoreLib/System/Text/Encoding.cs#L770-L781
So, that would incur:
1 string allocation '\0' -> "0"
1 string allocation for the string concat (text + "0")
I used this method for performance.
There was a problem hiding this comment.
I used this method for performance.
Relative impact of costs needs to be considered. So, for example, your change helps replace an unending amount of string->byte[] allocations with a single fixed number of allocations (<10). Improving allocation scenarios doesn't mean removing all allocations, just the costly ones :)
There was a problem hiding this comment.
that said, i'm fine with the code as is. It's nice and clear and doesn't do anything that seems unnecessary. Seems like a good solution to me.
There was a problem hiding this comment.
Ah, I just realized that I changed this locally before I moved the things to happen in the static ctors. I can simplify the code.
a7bf633 to
5f95e8a
Compare
jasonmalinowski
left a comment
There was a problem hiding this comment.
Just some nitpicks around naming and stuff. Would like them fixed, but otherwise good.
My standard "are you sure you want to target master?" applies.
There was a problem hiding this comment.
This should probably be called "ToUtf8WithNullTerminator" or something. Seeing initial use my thought was "why do we need a helper?"
There was a problem hiding this comment.
readonly? Yeah, the array is still mutable but it's a small protection.
There was a problem hiding this comment.
readonly everything here.
|
nice. |
|
Should be ok now. |
|
I think 15-7 is what we want. |
|
Fixed the Windows VisualStudio projects. Build should go green soon. Opened another issue about other projects not using the Packages.props values. #25148 |
|
@jasonmalinowski any idea what I might be doing wrong with the nuget package version? |
|
It looks like the package changed from having assets under the win7-x86 RID it's now just win-x86. You'll have to fix those paths. If you crack the nuget package you can see what's inside. |
|
Failures look unrelated? |
|
@dotnet/roslyn-infrastructure integration test failure? is it known issue? |
|
Yes, the queues are currently under maintinence. Given we don't have great unit test coverage of this, I'm tempted to say let's wait until those come back up before merging this. Have we also done the OSS paperwork? That needs to be done before merging. |
|
On another note, I should probably upgrade to a newer sqlitepclraw, as 1.1.11 is out. |
|
@jinujoseph no idea on when we are supposed to move the version up. and what paper work we need to do. |
|
new version bump will need paper work and understanding of why we would want to move . |
|
And I should comment: the paperwork is sometimes just rubber-stamped by a tool, so it's possibly quite easy. |
|
Fwiw, I saw submissions for 1.1.11 in osstool |
|
@Therzok Cool, then it might get rubber stamped. @jinujoseph who is doing the paperwork then, at least to see if it gets the rubber stamp? |
|
@ivanbasov is helping with the paperwork here..thanks |
|
I've sent a request for the OSS permission approval for sqlite. I will keep you informed. |
|
All the paperwork has been approved. We can proceed with the merge. Thank you! |
|
@jinujoseph This just needs an delegated M2 approval then. |
|
Approved to merge for 15.8.Preview3 |
Fixes #23424
NOTE: Currently using CI as a build bot, roslyn builds take too much time on my machine.
Ask Mode template not completed
Customer scenario
What does the customer do to get into this situation, and why do we think this
is common enough to address for this release. (Granted, sometimes this will be
obvious "Open project, VS crashes" but in general, I need to understand how
common a scenario is)
Bugs this fixes
(either VSO or GitHub links)
Workarounds, if any
Also, why we think they are insufficient for RC vs. RC2, RC3, or RTW
Risk
This is generally a measure our how central the affected code is to adjacent
scenarios and thus how likely your fix is to destabilize a broader area of code
Performance impact
(with a brief justification for that assessment (e.g. "Low perf impact because no extra allocations/no complexity changes" vs. "Low")
Is this a regression from a previous update?
Root cause analysis
How did we miss it? What tests are we adding to guard against it in the future?
How was the bug found?
(E.g. customer reported it vs. ad hoc testing)
Test documentation updated?
If this is a new non-compiler feature or a significant improvement to an existing feature, update https://github.com/dotnet/roslyn/wiki/Manual-Testing once you know which release it is targeting.