SQLite

Changes On Branch memsys5-performance
Login

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

Changes In Branch memsys5-performance Excluding Merge-Ins

This is equivalent to a diff from 6b98f0af to 8191b512

2013-11-24
00:46
The MEMSYS5 algorithm does not have to return the block with the lowest address. Any block of the appropriate size will do. Use the first block found on the freelist for the appropriate size for a performance improvement. (check-in: 12e612e8 user: drh tags: trunk)
2013-11-23
22:45
A much simpler fix is to simply change MEMSYS5 so that it takes any free block of the appropriate size (the first on the list of free blocks) rather than searching for the one with the smallest address. This is also faster than using the min-heap algorithm. Need to research to verify that the allocator still satisfies the Robson proof, however. (Closed-Leaf check-in: 8191b512 user: drh tags: memsys5-performance)
21:30
Use a heap-based primary queue rather than a linked list to store the available free blocks of each size in MEMSYS5, since this provides faster access to the first available block. (Closed-Leaf check-in: 7d2cdfad user: drh tags: memsys5-performance)
21:29
Add newlines at the end of some error messages in speedtest1. (check-in: 6b98f0af user: drh tags: trunk)
11:45
Report errors from sqlite3_exec() and sqlite3_config() in speedtest1. Fix a bug in the main testing logic that was found by these error reports. (check-in: 659f1a98 user: drh tags: trunk)

Changes to src/mem5.c.

210
211
212
213
214
215
216
217
218
219
220
221



222
223
224
225
226


227
228
229
230
231
232
233
}

/*
** Find the first entry on the freelist iLogsize.  Unlink that
** entry and return its index. 
*/
static int memsys5UnlinkFirst(int iLogsize){
  int i;
  int iFirst;

  assert( iLogsize>=0 && iLogsize<=LOGMAX );
  i = iFirst = mem5.aiFreelist[iLogsize];



  assert( iFirst>=0 );
  while( i>0 ){
    if( i<iFirst ) iFirst = i;
    i = MEM5LINK(i)->next;
  }


  memsys5Unlink(iFirst, iLogsize);
  return iFirst;
}

/*
** Return a block of memory of at least nBytes in size.
** Return NULL if unable.  Return NULL if nBytes==0.







<



|
>
>
>
|
|
|
|
|
>
>







210
211
212
213
214
215
216

217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
}

/*
** Find the first entry on the freelist iLogsize.  Unlink that
** entry and return its index. 
*/
static int memsys5UnlinkFirst(int iLogsize){

  int iFirst;

  assert( iLogsize>=0 && iLogsize<=LOGMAX );
  iFirst = mem5.aiFreelist[iLogsize];
#if 0
  {
    int i = iFirst;
    assert( iFirst>=0 );
    while( i>0 ){
      if( i<iFirst ) iFirst = i;
      i = MEM5LINK(i)->next;
    }
  }
#endif
  memsys5Unlink(iFirst, iLogsize);
  return iFirst;
}

/*
** Return a block of memory of at least nBytes in size.
** Return NULL if unable.  Return NULL if nBytes==0.