/ Check-in [8191b512]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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 Side-by-Side Diffs Show Whitespace Changes Patch

Changes to src/mem5.c.

   210    210   }
   211    211   
   212    212   /*
   213    213   ** Find the first entry on the freelist iLogsize.  Unlink that
   214    214   ** entry and return its index. 
   215    215   */
   216    216   static int memsys5UnlinkFirst(int iLogsize){
   217         -  int i;
   218    217     int iFirst;
   219    218   
   220    219     assert( iLogsize>=0 && iLogsize<=LOGMAX );
   221         -  i = iFirst = mem5.aiFreelist[iLogsize];
          220  +  iFirst = mem5.aiFreelist[iLogsize];
          221  +#if 0
          222  +  {
          223  +    int i = iFirst;
   222    224     assert( iFirst>=0 );
   223    225     while( i>0 ){
   224    226       if( i<iFirst ) iFirst = i;
   225    227       i = MEM5LINK(i)->next;
   226    228     }
          229  +  }
          230  +#endif
   227    231     memsys5Unlink(iFirst, iLogsize);
   228    232     return iFirst;
   229    233   }
   230    234   
   231    235   /*
   232    236   ** Return a block of memory of at least nBytes in size.
   233    237   ** Return NULL if unable.  Return NULL if nBytes==0.