SQLite

Check-in [fcd84ebabc]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Do not include the P3 parameter on OP_Integer opcodes if the integer will fit in 32 bits. The P3 conversion is slow. (CVS 1494)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: fcd84ebabca72023e76e6954514948aa9a3ab999
User & Date: drh 2004-05-30 01:38:43.000
Context
2004-05-30
01:51
Faster version of sqlite3VdbeSerialGet. (CVS 1495) (check-in: 80985505fe user: drh tags: trunk)
01:38
Do not include the P3 parameter on OP_Integer opcodes if the integer will fit in 32 bits. The P3 conversion is slow. (CVS 1494) (check-in: fcd84ebabc user: drh tags: trunk)
2004-05-29
21:46
A file format change for btree.c makes it between 10 and 20% faster. (CVS 1493) (check-in: cbcaece7f4 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/expr.c.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
** $Id: expr.c,v 1.132 2004/05/29 11:24:50 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

char const *sqlite3AffinityString(char affinity){
  switch( affinity ){
    case SQLITE_AFF_INTEGER: return "i";







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
** $Id: expr.c,v 1.133 2004/05/30 01:38:43 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

char const *sqlite3AffinityString(char affinity){
  switch( affinity ){
    case SQLITE_AFF_INTEGER: return "i";
1064
1065
1066
1067
1068
1069
1070
1071


1072
1073
1074
1075
1076
1077
1078
1079

/*
** Generate an instruction that will put the integer describe by
** text z[0..n-1] on the stack.
*/
static void codeInteger(Vdbe *v, const char *z, int n){
  int i;
  if( sqlite3GetInt32(z, &i) || (i=0, sqlite3FitsIn64Bits(z))!=0 ){


    sqlite3VdbeOp3(v, OP_Integer, i, 0, z, n);
  }else{
    sqlite3VdbeOp3(v, OP_Real, 0, 0, z, n);
  }
}

/*
** Generate code into the current Vdbe to evaluate the given







|
>
>
|







1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081

/*
** Generate an instruction that will put the integer describe by
** text z[0..n-1] on the stack.
*/
static void codeInteger(Vdbe *v, const char *z, int n){
  int i;
  if( sqlite3GetInt32(z, &i) ){
    sqlite3VdbeAddOp(v, OP_Integer, i, 0);
  }else if( sqlite3FitsIn64Bits(z) ){
    sqlite3VdbeOp3(v, OP_Integer, 0, 0, z, n);
  }else{
    sqlite3VdbeOp3(v, OP_Real, 0, 0, z, n);
  }
}

/*
** Generate code into the current Vdbe to evaluate the given
Changes to src/vdbemem.c.
205
206
207
208
209
210
211

212
213
214
215
216
217
218
219
220
221
222
223
}

/*
** Convert the Mem to have representation MEM_Int only.  All
** prior representations are invalidated.  NULL is converted into 0.
*/
int sqlite3VdbeMemIntegerify(Mem *pMem){

  if( pMem->flags & MEM_Int ){
    /* Do nothing */
  }else if( pMem->flags & MEM_Real ){
    pMem->i = (i64)pMem->r;
  }else if( pMem->flags & (MEM_Str|MEM_Blob) ){
    if( sqlite3VdbeChangeEncoding(pMem, TEXT_Utf8)
       || sqlite3VdbeMemNulTerminate(pMem) ){
      return SQLITE_NOMEM;
    }
    assert( pMem->z );
    sqlite3atoi64(pMem->z, &pMem->i);
  }else{







>
|

|

|







205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
}

/*
** Convert the Mem to have representation MEM_Int only.  All
** prior representations are invalidated.  NULL is converted into 0.
*/
int sqlite3VdbeMemIntegerify(Mem *pMem){
  int flags = pMem->flags;
  if( flags & MEM_Int ){
    /* Do nothing */
  }else if( flags & MEM_Real ){
    pMem->i = (i64)pMem->r;
  }else if( flags & (MEM_Str|MEM_Blob) ){
    if( sqlite3VdbeChangeEncoding(pMem, TEXT_Utf8)
       || sqlite3VdbeMemNulTerminate(pMem) ){
      return SQLITE_NOMEM;
    }
    assert( pMem->z );
    sqlite3atoi64(pMem->z, &pMem->i);
  }else{