1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-10 01:02:56 +03:00

Remove the use of 64-bit math in the offset computations of

the OP_Column opcode for a small performance improvement.

FossilOrigin-Name: 61a2c8d4d64c28119e9f06eb42f9c0437ba7a7bd
This commit is contained in:
drh
2010-02-05 14:12:53 +00:00
parent a963896796
commit 6658cd9a74
3 changed files with 20 additions and 16 deletions

View File

@@ -1,8 +1,8 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
C Fix\sa\sperformance\sglitch\sthat\sappears\sfor\slarge\stransactions.
D 2010-02-04T17:38:32
C Remove\sthe\suse\sof\s64-bit\smath\sin\sthe\soffset\scomputations\sof\s\nthe\sOP_Column\sopcode\sfor\sa\ssmall\sperformance\simprovement.
D 2010-02-05T14:12:54
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in c5827ead754ab32b9585487177c93bb00b9497b3
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -212,7 +212,7 @@ F src/update.c c0dc6b75ad28b76b619042d934f337b02acee208
F src/utf.c dad16adcc0c35ef2437dca125a4b07419d361052
F src/util.c aa0b1da8f71edff84b4b41dbe05fe6ac75d819c6
F src/vacuum.c 28ee5a4963d16cf2477075d85966c0f461cd79de
F src/vdbe.c b0c18b5c5ab4745a09b8f164e5db36413d98872e
F src/vdbe.c 78f2167915a8a9611e79eeaf13318d247abed185
F src/vdbe.h bea1f0cd530775bdb58a340265f3cf3ee920e9b2
F src/vdbeInt.h e276691b6835da5c0008cc5beaaecedcd7bdba8e
F src/vdbeapi.c a8b6a6617fc9a0492e4f7d6626d3afe994ddd3f2
@@ -789,14 +789,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P 1b6e6094c88214e02c9e3638932997ac20bfe413
R a169746145d95681a0eb74b572825817
P 26cb1df73504d5d883cf0967e57b46aa062d0b00
R 1958cacd7f583aec4ab73bfa77d04590
U drh
Z 2e5d2a4ce8f32874758dbc577421eb49
Z fc01b4de0eee88e8eb53af6f3beff67e
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFLawYboxKgR168RlERAqIiAJ9m+MAjJTz7+kI+tNhVlPG+dvXwEwCffivJ
RRcggDk+1C8swBXLSBSOFXQ=
=83UN
iD8DBQFLbCdpoxKgR168RlERAleAAJ9zp4nXhvCTHxqvWnr21SgA/iUicACdEllu
mfGoLjhZumCpTb2x8CplRYs=
=/N/5
-----END PGP SIGNATURE-----

View File

@@ -1 +1 @@
26cb1df73504d5d883cf0967e57b46aa062d0b00
61a2c8d4d64c28119e9f06eb42f9c0437ba7a7bd

View File

@@ -2068,7 +2068,7 @@ case OP_Column: {
u8 *zIdx; /* Index into header */
u8 *zEndHdr; /* Pointer to first byte after the header */
u32 offset; /* Offset into the data */
u64 offset64; /* 64-bit offset. 64 bits needed to catch overflow */
u32 szField; /* Number of bytes in the content of a field */
int szHdr; /* Size of the header size field at start of record */
int avail; /* Number of bytes of available data */
Mem *pReg; /* PseudoTable input register */
@@ -2243,12 +2243,16 @@ case OP_Column: {
** column and aOffset[i] will contain the offset from the beginning
** of the record to the start of the data for the i-th column
*/
offset64 = offset;
for(i=0; i<nField; i++){
if( zIdx<zEndHdr ){
aOffset[i] = (u32)offset64;
aOffset[i] = offset;
zIdx += getVarint32(zIdx, aType[i]);
offset64 += sqlite3VdbeSerialTypeLen(aType[i]);
szField = sqlite3VdbeSerialTypeLen(aType[i]);
offset += szField;
if( offset<szField ){ /* True if offset overflows */
zIdx = &zEndHdr[1]; /* Forces SQLITE_CORRUPT return below */
break;
}
}else{
/* If i is less that nField, then there are less fields in this
** record than SetNumColumns indicated there are columns in the
@@ -2268,8 +2272,8 @@ case OP_Column: {
** of the record (when all fields present), then we must be dealing
** with a corrupt database.
*/
if( (zIdx > zEndHdr)|| (offset64 > payloadSize)
|| (zIdx==zEndHdr && offset64!=(u64)payloadSize) ){
if( (zIdx > zEndHdr) || (offset > payloadSize)
|| (zIdx==zEndHdr && offset!=payloadSize) ){
rc = SQLITE_CORRUPT_BKPT;
goto op_column_out;
}