Quote:
it would be interesting if someone could compare the speed of the assembly to this version:
Not quite apples to apples as there are two differences:
-assembly version returns the number of successfully replaced chars (impossible with a macro)
-assembly version contains a safety check for length and will never write past the end of the target string
Anyway, with those differences in mind, here is the result of this test (debugger off, of course):
Code:
s=ElapsedMilliseconds()
For i=1 To 100000000
updatestring2(@"hello world!", @"girls", 6)
Next
t=ElapsedMilliseconds()
MessageRequester("", Str(t-s))
Macro version: 1748 ms
Assembly version: 904 ms (wilbert's last version, not my original)