VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

TurboSort

Brian Cidern  (4 Submissions)   String Manipulation   Visual Basic 3.0   Beginner   Wed 3rd February 2021


Sort arrays much faster with a better string
swapping routine!



Wow, I couldn't believe all the rewrites of the
same sorting routines in VBC. "Look at
mine", "No, use mine", yadda, yadda, yadda. They
all use the horribly slow:


vTemp = String1
String1 = String2
String1 = vTemp



Geezzzz - When you have to sort 30,000+ strings
this is slllooooowwwwwww.



Here's a solution. It uses the the same sorting
routine (or choose your own), but implements a much
faster swap routine using the CopyMemory() API. Now,
instead of swapping strings, which in my case could
be up to 9,000 characters, you are only swapping a
4 byte memory address.



Rock On!!


Assumes
Create a new EXE and throw in Command1 - Paste the rest.

Rate TurboSort (14(14 Vote))
TurboSort.bas

TurboSort Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters