mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Improvements to comments. Minor changes to code in the hot path of
OP_Column - with the hope of get a few cycles of performance improvement. FossilOrigin-Name: ca093103437f141caa3eb11539c6eb7b4dd65175
This commit is contained in:
25
src/vdbe.c
25
src/vdbe.c
@@ -2128,10 +2128,10 @@ case OP_NotNull: { /* same as TK_NOTNULL, jump, in1 */
|
||||
** The first OP_Column against a pseudo-table after the value of the content
|
||||
** register has changed should have this bit set.
|
||||
**
|
||||
** If the OPFLAG_LENGTHARG bit is set on P5 then the result is guaranteed
|
||||
** to only be used as the argument of a length() or typeof() function and
|
||||
** so loading of large blobs and strings can be skipped - all that is necessary
|
||||
** is that the size and type information be set.
|
||||
** If the OPFLAG_LENGTHARG and OPFLAG_TYPEOFARG bits are set on P5 when
|
||||
** the result is guaranteed to only be used as the argument of a length()
|
||||
** or typeof() function, respectively. The loading of large blobs can be
|
||||
** skipped for length() and all content loading can be skipped for typeof().
|
||||
*/
|
||||
case OP_Column: {
|
||||
u32 payloadSize; /* Number of bytes in the record */
|
||||
@@ -2272,7 +2272,7 @@ case OP_Column: {
|
||||
pC->aRow = 0;
|
||||
}
|
||||
}
|
||||
/* The following assert is true in all cases accept when
|
||||
/* The following assert is true in all cases except when
|
||||
** the database file has been corrupted externally.
|
||||
** assert( zRec!=0 || avail>=payloadSize || avail>=9 ); */
|
||||
szHdr = getVarint32((u8*)zData, offset);
|
||||
@@ -2347,11 +2347,11 @@ case OP_Column: {
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
/* If i is less that nField, then there are less fields in this
|
||||
/* If i is less that nField, then there are fewer fields in this
|
||||
** record than SetNumColumns indicated there are columns in the
|
||||
** table. Set the offset for any extra columns not present in
|
||||
** the record to 0. This tells code below to store a NULL
|
||||
** instead of deserializing a value from the record.
|
||||
** the record to 0. This tells code below to store the default value
|
||||
** for the column instead of deserializing a value from the record.
|
||||
*/
|
||||
aOffset[i] = 0;
|
||||
}
|
||||
@@ -2384,12 +2384,13 @@ case OP_Column: {
|
||||
VdbeMemRelease(pDest);
|
||||
sqlite3VdbeSerialGet((u8 *)&zRec[aOffset[p2]], aType[p2], pDest);
|
||||
}else{
|
||||
len = sqlite3VdbeSerialTypeLen(aType[p2]);
|
||||
t = aType[p2];
|
||||
len = sqlite3VdbeSerialTypeLen(t);
|
||||
if( (pOp->p5 & (OPFLAG_LENGTHARG|OPFLAG_TYPEOFARG))!=0
|
||||
&& (((t = aType[p2])>=12 && (t&1)==0) || (pOp->p5 & OPFLAG_TYPEOFARG)!=0)
|
||||
&& ((t>=12 && (t&1)==0) || (pOp->p5 & OPFLAG_TYPEOFARG)!=0)
|
||||
){
|
||||
/* Content is irrelevant for the typeof() function and for
|
||||
** the length(x) function is x is a blob. So we might as well use
|
||||
** the length(X) function if X is a blob. So we might as well use
|
||||
** bogus content rather than reading content from disk. NULL works
|
||||
** for text and blob and whatever is in the payloadSize64 variable
|
||||
** will work for everything else. */
|
||||
@@ -2403,7 +2404,7 @@ case OP_Column: {
|
||||
}
|
||||
zData = sMem.z;
|
||||
}
|
||||
sqlite3VdbeSerialGet((u8*)zData, aType[p2], pDest);
|
||||
sqlite3VdbeSerialGet((u8*)zData, t, pDest);
|
||||
}
|
||||
pDest->enc = encoding;
|
||||
}else{
|
||||
|
Reference in New Issue
Block a user