Changeset 7616


Ignore:
Timestamp:
Jan 4, 2009, 6:01:15 PM (12 years ago)
Author:
charles
Message:

(trunk libT) minor speedup tweaks in peer-request hotspots

Location:
trunk/libtransmission
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-io.h

    r7594 r7616  
    359359static inline struct evbuffer * tr_peerIoGetReadBuffer( tr_peerIo * io )
    360360{
    361     assert( tr_isPeerIo( io ) );
    362 
    363361    return io->inbuf;
    364362}
  • trunk/libtransmission/request-list.c

    r7615 r7616  
    2626        return a->offset < b->offset ? -1 : 1;
    2727
    28     if( a->length != b->length )
    29         return a->length < b->length ? -1 : 1;
    30 
    3128    return 0;
    3229}
    3330
    3431const struct request_list REQUEST_LIST_INIT = { 0, 0, NULL, NULL };
     32
     33static const int GROW = 8;
    3534
    3635static void
     
    3938    if( list->max < max )
    4039    {
    41         list->max = max;
     40        list->max = max + GROW;
    4241        list->fifo = tr_renew( struct peer_request, list->fifo, list->max );
    4342        list->sort = tr_renew( struct peer_request, list->sort, list->max );
  • trunk/libtransmission/utils.c

    r7609 r7616  
    13021302{
    13031303    size_t first = 0;
    1304 
    1305     while( nmemb > 0 )
     1304    const char * cbase = base;
     1305
     1306    while( nmemb )
    13061307    {
    13071308        const size_t half = nmemb / 2;
    13081309        const size_t middle = first + half;
    1309         const int c = compar( key, ((const char*)base) + size*middle );
     1310        const int c = compar( key, cbase + size*middle );
    13101311
    13111312        if( c < 0 )
Note: See TracChangeset for help on using the changeset viewer.