Re: Replace Better
- From: "Schmidt" <sss@xxxxxxxxx>
- Date: Sun, 27 Dec 2009 21:00:14 +0100
"Bee" <Bee@xxxxxxxxxxxxxxxxxxxxxxxxx> schrieb im Newsbeitrag
news:68BAA7A1-BF2E-4042-8FA3-F9A4845FC29B@xxxxxxxxxxxxxxxx
Based on what I have learned from this discussion,Would be good, to have a better description of what your
for my current needs, ...
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 doMostly yes, but one has to decide, if the effort worth it,
the scan and replace operations.
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 replaceThis again raises the question, what you're doing (trying) exactly -
longer (expand byte array) or shorter (shorten byte array) routines.
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
.
- Follow-Ups:
- Re: Replace Better
- From: Bee
- Re: Replace Better
- References:
- Replace Better
- From: Bee
- Re: Replace Better
- From: mayayana
- Re: Replace Better
- From: mayayana
- Re: Replace Better
- From: Schmidt
- Re: Replace Better
- From: Bee
- Replace Better
- Prev by Date: Re: Replace Better
- Next by Date: Re: Array Problem
- Previous by thread: Re: Replace Better
- Next by thread: Re: Replace Better
- Index(es):
Relevant Pages
|