Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.scripting.vbscript > #12333

Re: Why does a loop using instr() and mid() get slower on larger data ? - found it (I think)

From "Mayayana" <mayayana@invalid.nospam>
Newsgroups microsoft.public.scripting.vbscript
Subject Re: Why does a loop using instr() and mid() get slower on larger data ? - found it (I think)
Date 2021-01-03 12:51 -0500
Organization A noiseless patient Spider
Message-ID <rst07m$pa8$1@dont-email.me> (permalink)
References (4 earlier) <rsqnho$157m$2@gioia.aioe.org> <rsqs1f$5le$1@dont-email.me> <rsrtfa$1v8c$1@gioia.aioe.org> <rssian$hjo$1@dont-email.me> <rssm7m$5ai$1@gioia.aioe.org>

Show all headers | View raw


"R.Wieser" <address@not.available> wrote

| >  Did you try a UCase or LCase first and then ReadAll?
|
| Whut ?   How do you suppose I would be able to do that ?    I would think 
I
| would need to read the data before being able to act upon it ....
|

   I just meant using both of those methods as one
option to test.
s = TS.ReadAll
s = UCase(s)
Pt1 = Instr(s, "findstring")

| > I don't see the point of reading by line
|
| The drawback of reading everything into memory and doing an initial lcase 
or
| ucase is that you have to assume that none of the files data is in a
| mixed-case form thats important to the user.   In my case the OSM file
| contains name of streets, etc.   Those I would like to keep the casing.
|

    I've run into that before. In that case I just
have two:

s2 = UCase(s)
pt1 = InStr(s2, "MAPLE ST.")
if Pt1 > 0 then x = Mid(s, pt1, 9)

  The speed difference is worth it. Ive written a lot of
scripts that do intensive work, such as converting
an HXS to CHM and heavily editing every HTML file
before doing the CHM compile.
  I've found the two things that make a very notable
difference in speed are concatenating with arrays
and case-sensitive search. When I'm doing it for 100
files, and rebuilding each file, that makes a big difference.

Back to microsoft.public.scripting.vbscript | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Why does a loop using instr() and mid() get slower on larger data ? "R.Wieser" <address@not.available> - 2021-01-02 12:41 +0100
  Re: Why does a loop using instr() and mid() get slower on larger data ? "Mayayana" <mayayana@invalid.nospam> - 2021-01-02 08:39 -0500
    Re: Why does a loop using instr() and mid() get slower on larger data ? "R.Wieser" <address@not.available> - 2021-01-02 16:46 +0100
      Re: Why does a loop using instr() and mid() get slower on larger data ? "Mayayana" <mayayana@invalid.nospam> - 2021-01-02 15:26 -0500
        Re: Why does a loop using instr() and mid() get slower on larger data ? "R.Wieser" <address@not.available> - 2021-01-02 22:11 +0100
          Re: Why does a loop using instr() and mid() get slower on larger data ? "Mayayana" <mayayana@invalid.nospam> - 2021-01-02 17:27 -0500
            Re: Why does a loop using instr() and mid() get slower on larger data ? - found it (I think) "R.Wieser" <address@not.available> - 2021-01-03 08:58 +0100
              Re: Why does a loop using instr() and mid() get slower on larger data ? - found it (I think) "Mayayana" <mayayana@invalid.nospam> - 2021-01-03 08:54 -0500
                Re: Why does a loop using instr() and mid() get slower on larger data ? - found it (I think) "R.Wieser" <address@not.available> - 2021-01-03 16:01 +0100
                Re: Why does a loop using instr() and mid() get slower on larger data ? - found it (I think) "Mayayana" <mayayana@invalid.nospam> - 2021-01-03 12:51 -0500
                Re: Why does a loop using instr() and mid() get slower on larger data ? - found it (I think) "R.Wieser" <address@not.available> - 2021-01-03 19:26 +0100
          Re: Why does a loop using instr() and mid() get slower on larger data ? "Mayayana" <mayayana@invalid.nospam> - 2021-01-02 17:43 -0500
  Re: Why does a loop using instr() and mid() get slower on larger data ? JJ <jj4public@gmail.com> - 2021-01-03 02:47 +0700
    Re: Why does a loop using instr() and mid() get slower on larger data ? "R.Wieser" <address@not.available> - 2021-01-02 21:47 +0100

csiph-web