/ Check-in [8191b512]
Login

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

Overview
Comment: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.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | memsys5-performance
Files: files | file ages | folders
SHA1:8191b512122c13d7fa61d8e5487652f13ec172f7
User & Date: drh 2013-11-23 22:45:12
Context
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:29
Add newlines at the end of some error messages in speedtest1. check-in: 6b98f0af user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

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.