From 696b32fa4e9d995087b3befc8ff84a1329d12c86 Mon Sep 17 00:00:00 2001 From: drh Date: Sun, 30 May 2004 01:51:52 +0000 Subject: [PATCH] Faster version of sqlite3VdbeSerialGet. (CVS 1495) FossilOrigin-Name: 80985505fe8ba8e505842dae95d37bf412fc586d --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/vdbeaux.c | 53 ++++++++++++++++----------------------------------- 3 files changed, 23 insertions(+), 44 deletions(-) diff --git a/manifest b/manifest index 7450fb533e..e9f1ae8145 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Do\snot\sinclude\sthe\sP3\sparameter\son\sOP_Integer\sopcodes\sif\sthe\sinteger\swill\sfit\nin\s32\sbits.\s\sThe\sP3\sconversion\sis\sslow.\s(CVS\s1494) -D 2004-05-30T01:38:43 +C Faster\sversion\sof\ssqlite3VdbeSerialGet.\s(CVS\s1495) +D 2004-05-30T01:51:52 F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd @@ -73,7 +73,7 @@ F src/vdbe.c c9658279c8d46760afab9714fd988ef052d02b88 F src/vdbe.h e73f890e0f2a6c42b183d7d6937947930fe4fdeb F src/vdbeInt.h c2bcd6e5a6e6a3753e4c5a368629c3a625719bfc F src/vdbeapi.c 0c5d64c81871cb4fe5407e639604ee95738b6942 -F src/vdbeaux.c 79dbad52ba653c0f26adcab1a054432669775b0d +F src/vdbeaux.c 419f62488256ac083a996893a46d55180347f3c2 F src/vdbemem.c d5f96663627d54ee8ea47f182c92faa57a015704 F src/where.c 444a7c3a8b1eb7bba072e489af628555d21d92a4 F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242 @@ -204,7 +204,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604 F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4 -P cbcaece7f45a0bc994e6c54a996afa4e6529da6a -R 258b847515a631fd85af8a899101683c +P fcd84ebabca72023e76e6954514948aa9a3ab999 +R 3f1817a302e026eaf4a3f04c4eee66ee U drh -Z b2fca084d3ec68b05f90cc6a90870693 +Z 2739751628cd79cb153057eaa6054ddd diff --git a/manifest.uuid b/manifest.uuid index 0a1c977bd5..bc7212d320 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -fcd84ebabca72023e76e6954514948aa9a3ab999 \ No newline at end of file +80985505fe8ba8e505842dae95d37bf412fc586d \ No newline at end of file diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 0652d70b6a..15bce1ce5d 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -1172,18 +1172,6 @@ int sqlite3VdbeSerialTypeLen(u32 serial_type){ static u8 aSize[] = { 0, 1, 2, 4, 8, 8, 0, }; return aSize[serial_type]; } -#if 0 - switch(serial_type){ - case 6: return 0; /* NULL */ - case 1: return 1; /* 1 byte integer */ - case 2: return 2; /* 2 byte integer */ - case 3: return 4; /* 4 byte integer */ - case 4: return 8; /* 8 byte integer */ - case 5: return 8; /* 8 byte float */ - } - assert( serial_type>=12 ); - return ((serial_type-12)>>1); /* text or blob */ -#endif } /* @@ -1237,24 +1225,12 @@ int sqlite3VdbeSerialGet( ){ int len; + len = sqlite3VdbeSerialTypeLen(serial_type); assert( serial_type!=0 ); - - /* memset(pMem, 0, sizeof(pMem)); */ - pMem->flags = 0; - pMem->z = 0; - - /* NULL */ - if( serial_type==6 ){ - pMem->flags = MEM_Null; - pMem->type = SQLITE3_NULL; - return 0; - } - - /* Integer and Real */ if( serial_type<=5 ){ + /* Integer and Real */ u64 v = 0; int n; - len = sqlite3VdbeSerialTypeLen(serial_type); if( buf[0]&0x80 ){ v = -1; @@ -1271,18 +1247,21 @@ int sqlite3VdbeSerialGet( pMem->i = *(i64*)&v; pMem->type = SQLITE3_INTEGER; } - return len; - } - - /* String or blob */ - assert( serial_type>=12 ); - len = sqlite3VdbeSerialTypeLen(serial_type); - pMem->z = (char *)buf; - pMem->n = len; - if( serial_type&0x01 ){ - pMem->flags = MEM_Str | MEM_Ephem; + }else if( serial_type>=12 ){ + /* String or blob */ + pMem->z = (char *)buf; + pMem->n = len; + if( serial_type&0x01 ){ + pMem->flags = MEM_Str | MEM_Ephem; + }else{ + pMem->flags = MEM_Blob | MEM_Ephem; + } }else{ - pMem->flags = MEM_Blob | MEM_Ephem; + /* NULL */ + assert( serial_type==6 ); + assert( len==0 ); + pMem->flags = MEM_Null; + pMem->type = SQLITE3_NULL; } return len; }