/ Check-in [4e374912]
Login

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

Overview
Comment:Do exponential rather than linear expansion of the SrcList.a array when appending new elements, to reduce the number of malloc() calls.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4e3749127e7249f46e17bfabc614b0876f60565a
User & Date: drh 2016-12-15 18:59:14
Context
2016-12-16
01:00
All temp.sqlite_master to be used as an alias for sqlite_temp_master. check-in: 8d646905 user: drh tags: trunk
2016-12-15
18:59
Do exponential rather than linear expansion of the SrcList.a array when appending new elements, to reduce the number of malloc() calls. check-in: 4e374912 user: drh tags: trunk
2016-12-14
14:07
Refactor the Table.nRef field as Table.nTabRef for easier grepping. check-in: 9cae4c2e user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/build.c.

  3654   3654     assert( nExtra>=1 );
  3655   3655     assert( pSrc!=0 );
  3656   3656     assert( iStart<=pSrc->nSrc );
  3657   3657   
  3658   3658     /* Allocate additional space if needed */
  3659   3659     if( (u32)pSrc->nSrc+nExtra>pSrc->nAlloc ){
  3660   3660       SrcList *pNew;
  3661         -    int nAlloc = pSrc->nSrc+nExtra;
         3661  +    int nAlloc = pSrc->nSrc*2+nExtra;
  3662   3662       int nGot;
  3663   3663       pNew = sqlite3DbRealloc(db, pSrc,
  3664   3664                  sizeof(*pSrc) + (nAlloc-1)*sizeof(pSrc->a[0]) );
  3665   3665       if( pNew==0 ){
  3666   3666         assert( db->mallocFailed );
  3667   3667         return pSrc;
  3668   3668       }