[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [RFC] diff-optimizations-bytes branch: avoiding function call overhead (?)

From: Julian Foad <julian.foad_at_wandisco.com>
Date: Mon, 20 Dec 2010 10:03:33 +0000

On Mon, 2010-12-20, Johan Corveleyn wrote:
> New macro version (increment only, decrement is similar):
> [[[
> /* For all files in the FILE array, increment the curp pointer. If a file
> * points before the beginning of file, let it point at the first byte again.
> * If the end of the current chunk is reached, read the next chunk in the
> * buffer and point curp to the start of the chunk. If EOF is reached, set
> * curp equal to endp to indicate EOF. */
> #define increment_pointers(all_files, files_len, pool) \
> do { \
> int i; \
> \
> for (i = 0; i < files_len; i++) \
> { \
> if (all_files[i]->chunk == -1) /* indicates before beginning of file */\
> all_files[i]->chunk = 0; /* point to beginning of file again */ \
> else if (all_files[i]->curp != all_files[i]->endp - 1) \
> all_files[i]->curp++; \

Hi Johan.

Here you are having to test for two special cases every time: chunk==-1
and curp==endp-1. I would suggest changing the specification of "before
beginning of file" to include the promise that curp==endp-1, so that you
don't have to use a separate test here and can instead test for this
special case within increment_chunk().

- Julian
Received on 2010-12-20 11:04:17 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.