Prop. search speedup idea

From: Mike Nordell (tamlin@algonet.se)
Date: Fri Sep 26 2003 - 02:47:05 EDT

  • Next message: Mike Nordell: "Re: Prop. search speedup idea"

    I just came to think of something. It's not a suggestion or something,
    merely an Idea I got that perhaps someone would like to test.

    Pseudoish code:

    Prop* FindStringInSet(const char* szProp, PropSet& propset)
    {
      curr = propset.begin();
      end = propset.end();
      for (; curr != end; ++curr)
      {
        const char* pszVal = curr->val;
        if (pszVal[0] == szProp[0] && !str(i)cmp(pszVal, szProp)) {
          return curr;
        }
      }
      return 0;
    }

    It doesn't change the complexity of the search, but it wouldn't surprise me
    the least if the short-circuit check for first char matching could make
    difference. I recall having made something similar in the past which proved
    to have an *extreme* effect (2-3 orders of magnitude IIRC).

    /Mike



    This archive was generated by hypermail 2.1.4 : Fri Sep 26 2003 - 03:02:11 EDT