Results 1 to 5 of 5

Thread: Interesting Find, Please Read

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 1999
    Location
    NY
    Posts
    45

    Post

    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

  2. #2
    Hyperactive Member
    Join Date
    Sep 1999
    Posts
    305

    Post

    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.


  3. #3

    Thread Starter
    Member
    Join Date
    Feb 1999
    Location
    NY
    Posts
    45

    Post

    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

  4. #4
    Hyperactive Member
    Join Date
    Jan 1999
    Location
    Rotterdam, Netherlands
    Posts
    386

    Post

    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)

  5. #5

    Thread Starter
    Member
    Join Date
    Feb 1999
    Location
    NY
    Posts
    45

    Post

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width