/ Check-in [8885b446]
Login

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

Overview
Comment:Very small performance increase in sqlite3VdbeSetNumCols().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8885b4461044ae8ecdfe1b9aa47f4aad65efabc98e3fcd9e307a06504fab34c6
User & Date: drh 2017-05-31 11:24:13
Context
2017-05-31
13:27
Remove a completely unnecessary memset() from the INSERT code generator. check-in: 7d58836b user: drh tags: trunk
11:24
Very small performance increase in sqlite3VdbeSetNumCols(). check-in: 8885b446 user: drh tags: trunk
03:20
Reorder fields in the PgHdr object for a performance increase. check-in: 326e63d7 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbeaux.c.

  2156   2156   /*
  2157   2157   ** Set the number of result columns that will be returned by this SQL
  2158   2158   ** statement. This is now set at compile time, rather than during
  2159   2159   ** execution of the vdbe program so that sqlite3_column_count() can
  2160   2160   ** be called on an SQL statement before sqlite3_step().
  2161   2161   */
  2162   2162   void sqlite3VdbeSetNumCols(Vdbe *p, int nResColumn){
  2163         -  Mem *pColName;
  2164   2163     int n;
  2165   2164     sqlite3 *db = p->db;
  2166   2165   
  2167         -  releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);
  2168         -  sqlite3DbFree(db, p->aColName);
         2166  +  if( p->nResColumn ){
         2167  +    releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);
         2168  +    sqlite3DbFree(db, p->aColName);
         2169  +  }
  2169   2170     n = nResColumn*COLNAME_N;
  2170   2171     p->nResColumn = (u16)nResColumn;
  2171         -  p->aColName = pColName = (Mem*)sqlite3DbMallocRawNN(db, sizeof(Mem)*n );
         2172  +  p->aColName = (Mem*)sqlite3DbMallocRawNN(db, sizeof(Mem)*n );
  2172   2173     if( p->aColName==0 ) return;
  2173         -  initMemArray(p->aColName, n, p->db, MEM_Null);
         2174  +  initMemArray(p->aColName, n, db, MEM_Null);
  2174   2175   }
  2175   2176   
  2176   2177   /*
  2177   2178   ** Set the name of the idx'th column to be returned by the SQL statement.
  2178   2179   ** zName must be a pointer to a nul terminated string.
  2179   2180   **
  2180   2181   ** This call must be made after a call to sqlite3VdbeSetNumCols().