Re: Replace Better

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"Bee" <Bee@xxxxxxxxxxxxxxxxxxxxxxxxx> schrieb im Newsbeitrag
news:68BAA7A1-BF2E-4042-8FA3-F9A4845FC29B@xxxxxxxxxxxxxxxx

Based on what I have learned from this discussion,
for my current needs, ...
Would be good, to have a better description of what your
needs really are - is it the same "vbCr-replacement"-problem
you described earlier - or some new stuff?
With a bit more background better suggestions are possible.

...it seems that working with a byte array is faster to do
the scan and replace operations.
Mostly yes, but one has to decide, if the effort worth it,
to write each and every "specialized string-routine" based
on Byte- or 16Bit-Integer-Arrays.
IMO one does not need to "go there" that often - VBs builtin
stuff is sufficient in nearly all cases.


So now I am looking for a fast byte array replace that will replace
longer (expand byte array) or shorter (shorten byte array) routines.
This again raises the question, what you're doing (trying) exactly -
and why you're looking for more performance ... maybe the
bottleneck is at some other end...

Converting from string to byte array and back is done only at
the beginning and end of the scan and replace op that I need
to do. And those conversion ops seem plenty fast like 2 mSec
on my PC.

The Demos, which use/show the SafeArray-mapping, avoid
explicit conversions to and from ByteArrays - they
span something like a "virtual array" over an already
existing String-Content.
That said, in case one does it explicitely (as copy) before/after
processing a "heavy routine" (especially if the passed string-
parameter is a larger one) - then the overhead, compared with
safearray-mapping is not all that large.

The decision, if you should work with ByteArrays throughout
the whole process depends on your real problem, e.g. if you
start on FileContent, which was safed as ANSI ... but also on
how comfortable you want to code (also reflecting a bit on
"code-readability" later on) - and of course which performance
requirements need to be met.

The Mapping-approach is nice insofar as you could switch
into (virtual) array-mode only *within* a few (bottleneck)
routines maybe - and (aside from these few exceptions)
always work with normally passed VB-String-Parameters
through the larger process in question.

Olaf


.



Relevant Pages

  • array argument checking style issue
    ... developing a library of routines. ... and the array arguments will be assumed shape arrays. ... My library contains subroutine foo, ... Can I choose a debugging option that ...
    (comp.lang.fortran)
  • Re: Defining variable type at runtime?
    ... routines that operate on real data over using the routines operating on ... There is another case to consider, and that is the complex FFT ... imaginary part to create an N point complex array, ... saving two multiplies by zero and two multiplies by one. ...
    (comp.lang.fortran)
  • Re: sorting roman numbers
    ... Ivo wrote: ... I've worked with roman numerals... ... VIIII is more appropriate for 9, but my routines stick with IX), at ... (You can try adding them into the $lookup array -- notice how the ...
    (comp.lang.php)
  • Re: I need the fastest routine
    ... I am hired to improve the diagnostic routines of a machine that tests hardware device. ... The hardware send "arrays" of doubles that must be checked according to their index. ... That's why I can't order the array. ...
    (borland.public.delphi.language.basm)
  • Re: Listing data without blank rows
    ... The IFis generating a virtual array, ... This leads us to ... the general philosophy of trapping errors: ...
    (microsoft.public.excel.worksheet.functions)