All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikita Danilov <Nikita@Clusterfs.COM>
To: David Dabbs <david@dabbs.net>
Cc: reiserfs-list@namesys.com
Subject: Re: Performance improvements to key comparison functions
Date: Tue, 13 Jul 2004 00:04:08 +0400	[thread overview]
Message-ID: <16626.61112.905268.684688@laputa.namesys.com> (raw)
In-Reply-To: <20040712183919.0958A15F92@mail03.powweb.com>

David Dabbs writes:
 > 
 > If you downloaded the code at http://dabbs.net/reiser4 I have uploaded a new
 > zip file. I posted an incorrect version when I uploaded it in the wee hours
 > this morning. 

----------------------------------------------------------------------
static inline cmp_t_new
keycmp_new( const reiser4_key * k1 /* first key to compare */ ,
const reiser4_key * k2 /* second key to compare */ )
{
   __u64 v1, v2;
  
   if ((v1=get_key_el(k1,0)) != (v2=get_key_el(k2,0)))
      return (v1 > v2);
   if ((v1=get_key_el(k1,1)) != (v2=get_key_el(k2,1))) 
      return (v1 > v2);
   if ((v1=get_key_el(k1,2)) != (v2=get_key_el(k2,2)))
      return (v1 > v2); 
   if ((v1=get_key_el(k1,3)) != (v2=get_key_el(k2,3)))
      return (v1 > v2);
  
   return EQUAL_TO_NEW;
}
----------------------------------------------------------------------

Note that comparisons in C (like (v1 > v2)) are not guaranteed to return 0
or _1_ as a result, but simply zero, or _non-zero_.

Standard trick to "normalize" comparison result is to do

    return !!(v1 > v2));

etc. In the same vein, "isunique" argument of
znode_contains_key_strict_new() is not guaranteed to be 0 or 1, which
renders this function wrong.

That said, I think that proper way to test your functions is to plug
them into kernel reiser4 version and run some CPU intensive tests.

 >   
 > David
 > 
 > 

Good luck,
Nikita.

 > 

  reply	other threads:[~2004-07-12 20:04 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-12 18:38 Performance improvements to key comparison functions David Dabbs
2004-07-12 20:04 ` Nikita Danilov [this message]
2004-07-12 20:26   ` David Dabbs
2004-07-10 23:18     ` Nikita Danilov
2004-07-12 21:27       ` David Dabbs
2004-07-11  0:01         ` Nikita Danilov
2004-07-12 22:03           ` David Dabbs
2004-07-12 12:00             ` Nikita Danilov
2004-07-13 17:58               ` David Dabbs
2004-07-12 20:49   ` David Dabbs
2004-07-10 23:23     ` Nikita Danilov
2004-07-12 21:07     ` mjt
2004-07-13 18:19       ` Hans Reiser
2004-07-12 21:42     ` Philippe Gramoullé
  -- strict thread matches above, loose matches on Subject: below --
2004-07-12  8:48 David Dabbs
2004-07-13 18:33 ` Hans Reiser
2004-07-13 19:59   ` David Dabbs
2004-07-14  6:59     ` Hans Reiser
2004-06-22 10:53       ` David Dabbs
2004-07-13 22:18   ` David Dabbs
2004-07-14  7:03     ` Hans Reiser
2004-06-23  8:43 David Dabbs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16626.61112.905268.684688@laputa.namesys.com \
    --to=nikita@clusterfs.com \
    --cc=david@dabbs.net \
    --cc=reiserfs-list@namesys.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.