TODO hardlink performance optimizations

John Van Essen vanes002 at umn.edu
Wed Jan 7 06:23:43 GMT 2004


On Mon, 5 Jan 2004 19:09:23 -0800, jw schultz <jw at pegasys.ws> wrote:
> On Mon, Jan 05, 2004 at 01:44:37AM -0600, John Van Essen wrote:
....
>> I did that differently (and more simply, I think).  Changed only one line
>> and added two lines:
>> 
>> @@ -24,8 +24,11 @@
>>  extern int verbose;
>> 
>>  #if SUPPORT_HARD_LINKS
>> -static int hlink_compare(struct file_struct *f1, struct file_struct *f2)
>> +static int hlink_compare(struct file_struct **f1p, struct file_struct **f2p)
>>  {
>> +       struct file_struct *f1 = *f1p;
>> +       struct file_struct *f2 = *f2p;
>> +
>>         if (!S_ISREG(f1->mode) && !S_ISREG(f2->mode))
>>                 return 0;
>>         if (!S_ISREG(f1->mode))
> 
> My changes were patterned after file_compare().  The
> compiler should produce approximately the same code but
> your's is a little more readable.  If we go with yours i'd
> suggest we update file_compare() to match.  Consistancy of
> code is more important that patch size.

An optimizing compiler should, indeed, produce approximately the
same code.  Tweaking file_compare to make it more readable and
consistent with hlink_compare is a good idea.  Go for it.  :)
-- 
        John Van Essen  Univ of MN Alumnus  <vanes002 at umn.edu>



More information about the rsync mailing list