Announcement

Collapse
No announcement yet.

Need better (faster) INSTR

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #41
    OK, clarification of my App's requirement..

    When a new buffer allocation is needed, it is because an array of UDTs, is having 1 or more entries inserted. One of the fields in the UDT is a STRING POINTER (since we can't have dynamic strings) So as each new UDT entry is filled in, a free STRING buffer must be allocated and saved in the STRING POINTER.

    This insert a new UDT routine is passed the number of entries being inserted into the UDT array. When it's > 1, the INSTR search for 'next available' buffer starts @ the previous successful INSTR location + 1. (everything left of that point we know is in use). Except the 1st search of course which starts at 1. So these 'bulk mode' free buffer searches are very quick.

    Where my INSTR approach performs poorly is when these inserts are requested for inserts of single items, since for those, the INSTR search always starts at position 1.

    Paul: I looked at your stack approach, it sure looks like it has all these others beat. Yes, it takes 4 bytes per buffer, but nowadays what's 5-10 megabytes.

    George

    Comment


    • #42
      Instead of INSTR, use REGEXPR, which DOES support a "start position."

      ??
      Michael Mattias
      Tal Systems Inc. (retired)
      Racine WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #43
        Is anyone aware that INSTR() has an optional start position parameter? Just INCR previous INSTR return.

        Not saying it is best way to do this job, just that full power of INSTR is not being used.
        Dale

        Comment


        • #44
          use REGEXPR,
          REGEXPR is a lot slower than INSTR.

          Comment


          • #45
            Originally posted by Michael Mattias View Post
            Instead of INSTR, use REGEXPR, which DOES support a "start position."

            ??
            So does INSTR

            And the Heading is: Need better (faster) INSTR

            RegExp is much slower than INSTR

            Comment


            • #46
              And I DID say that for multiple requests the INSTR search starts at the last successful position + 1.

              And many thanks to all of you for the many suggestions. Invaluable.

              Comment


              • #47
                Is anyone aware that INSTR() has an optional start position parameter? Just INCR previous INSTR return.
                I am now. That is a feature I totally missed, apparently for many years. My bad.

                And the Heading is: Need better (faster) INSTR
                And? I read this as a request to get something faster than INSTR.

                You will also note earlier in this thread I made two different "design change" suggestions to remove the (currently) INSTR-related bottleneck in the program. I have always, do now and for the forseeable future have this old-fashioned belief that there is a lot more performance gained by design than by programming technique such as choice of intrinsic functions used.

                Michael Mattias
                Tal Systems Inc. (retired)
                Racine WI USA
                [email protected]
                http://www.talsystems.com

                Comment


                • #48
                  Originally posted by Michael Mattias View Post
                  And? I read this as a request to get something faster than INSTR.
                  And you recommended the slower REGEXPR in reply

                  Comment


                  • #49
                    And you recommended the slower REGEXPR in reply
                    Um, not "recommended," sir, but SUGGESTED, as something to be tried and evaluated for use in this application. .

                    What I "recommended" was changing the design to eliminate the bottleneck, but OP Mr. DeLuca ruled that out as "just too big a change." (Post #12 this thread).

                    Michael Mattias
                    Tal Systems Inc. (retired)
                    Racine WI USA
                    [email protected]
                    http://www.talsystems.com

                    Comment


                    • #50
                      Originally posted by Michael Mattias View Post
                      Um, not "recommended," sir, but SUGGESTED, as something to be tried and evaluated for use in this application. .
                      "Instead of INSTR, use REGEXPR, which DOES support a "start position."

                      Looks more like a recommendation (or even a direction or instruction) rather that a suggestion to me.

                      Comment

                      Working...
                      X