Update of /cvsroot/pure-data/externals/zexy/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26297
Modified Files: fifop.c Log Message: speeding things up significantly when handling looong FIFOs by storing both the first(=read) and the last(=write) entry
Index: fifop.c =================================================================== RCS file: /cvsroot/pure-data/externals/zexy/src/fifop.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** fifop.c 25 May 2005 09:18:31 -0000 1.4 --- fifop.c 25 May 2005 09:39:46 -0000 1.5 *************** *** 43,46 **** --- 43,47 ---- t_float priority; t_fifop_list *fifo_start; + t_fifop_list *fifo_end; struct _fifop_prioritylist *next; } t_fifop_prioritylist; *************** *** 79,82 **** --- 80,84 ---- result->priority=priority; result->fifo_start=0; + result->fifo_end=0; result->next=0;
*************** *** 85,89 **** /* insert at the beginning */ result->next=x->fifo_list; ! x->fifo_list=result; } else { /* post insert into the list of FIFOs */ --- 87,91 ---- /* insert at the beginning */ result->next=x->fifo_list; ! x->fifo_list=result; } else { /* post insert into the list of FIFOs */ *************** *** 121,133 **** entry->next=0;
! /* go to end of fifo */ ! fifo=fifoprio->fifo_start; ! if(fifo){ ! while(fifo->next!=0)fifo=fifo->next; /* add new entry to end of fifo */ fifo->next=entry; } else { /* the new entry is the 1st entry of the fifo */ fifoprio->fifo_start=entry; } } --- 123,139 ---- entry->next=0;
! /* insert entry into fifo */ ! if(fifoprio->fifo_end){ ! /* append to the end of the fifo */ ! fifo=fifoprio->fifo_end; ! /* add new entry to end of fifo */ fifo->next=entry; + fifoprio->fifo_end=entry; } else { /* the new entry is the 1st entry of the fifo */ fifoprio->fifo_start=entry; + /* and at the same time, it is the last entry */ + fifoprio->fifo_end =entry; } } *************** *** 164,168 ****
pfifo->fifo_start=fifo->next; ! /* get the list from the entry */ argc=fifo->argc; --- 170,176 ----
pfifo->fifo_start=fifo->next; ! if(0==pfifo->fifo_start){ ! pfifo->fifo_end=0; ! } /* get the list from the entry */ argc=fifo->argc; *************** *** 204,207 **** --- 212,216 ---- fifo_list2->priority =0; fifo_list2->fifo_start=0; + fifo_list2->fifo_end =0; fifo_list2->next =0; freebytes(fifo_list2, sizeof( t_fifop_prioritylist));