Click to See Complete Forum and Search --> : Interesting Find, Please Read
mystiq
Nov 28th, 1999, 02:28 AM
I wrote a program a long time ago that'll compare two different pieces of code. Lately, i just found out about the VB Replace function, all along i've been using a custom-made one. And to my surprise, i ran the test several times, my function is about 2-3x faster than the VB function! ***? I would paste the code but i since deleted my function thinking the VB version would be faster.
------------------
-Mystiq
Bob Baddeley
Nov 28th, 1999, 03:07 AM
c'est la vie, n'est pas?
you wrote it once, so you could probably rewrite it without too much difficulty. That's really kind of funny.
:)
mystiq
Nov 28th, 1999, 03:09 AM
The funny part is that my version was faster. The sad part is that i could probably rewrite, and make it faster (which i'll do when i feel like it, hehe).
------------------
-Mystiq
Crazy D
Nov 28th, 1999, 02:29 PM
Why your code is faster? Ask the M$ ppl for the source of the Replace function as implemented in VB. Build-in functions are handy, but not always faster then you're own code (this might depend too on compiler options, like integer overflow checks)
mystiq
Nov 28th, 1999, 08:09 PM
God only knows why my code is faster but it is, and good luck trying to get even a response from Microsloth tech support. The only time i got a reply from them is when i emailed them two times for a DirectX problem (mind you i still havent gotten a good answer :). All the code i wrote basically does is InStr for the string, get the left of right, get the right of it, stick the new string in the middle, set the cursor position to the right, and search some more, and repeat step 1 until it's done. Knowing MS (and since C++ lies under VB) it uses a character array and does a char by char search, which is slower than a whole string search :)
------------------
-Mystiq
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.