# HG changeset patch # User michael # Date 1268147963 0 # Node ID 821155aecf2ab5ce3cbcab19b45c273e6cf97841 # Parent 2af44abfbfe83b88ee54844c415fe1922025004c Add special case to avoid binary search when appending index entries. diff -r 2af44abfbfe8 -r 821155aecf2a utils.c --- a/utils.c Tue Mar 09 14:59:40 2010 +0000 +++ b/utils.c Tue Mar 09 15:19:23 2010 +0000 @@ -1305,6 +1305,10 @@ a = - 1; b = nb_entries; + //optimize appending index entries at the end + if(b && entries[b-1].timestamp < wanted_timestamp) + a= b-1; + while (b - a > 1) { m = (a + b) >> 1; timestamp = entries[m].timestamp;