|
-
May 14th, 2008, 10:50 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Optimization tricks needed - VERY LARGE Select Case statement
###Resume: App too long to compile because of 2000-cases long "Select Case" statements###
I have an application that has been developped a long time ago which has been serving me very well for the last few years.
The only problem is that compiling it under VB6 takes a while (something like 2-3-4 minutes - which is very long, on a fairly good machine). I don't have to recompile that often so I never took the time to fix this. Now the time has come.
The only cause is that I have a module with 5-6 "Select Case" statements. Each of those statements has something like 2000 cases. I would have made only one single select, but VB6 wouldn't handle that long.
The purpose of these statements are to return random words. I love to play with databases (that's actually where those words come from) but at first I wanted the application to have those words totally implemented, avoiding the need of any recordset or links to a database.
I have thought of one solution, and I'm posting here before implementing in case someone has a good idea/workaround for this... here it is:
Since I don't want my application (which is constantly running) to connect to an external database over and over, I thought I could simply fill a recordset with all those words on the form_load so that my application can randomly pick words in that "huge" recordset quite quickly. The recordset is filled once, and I don't think it will eat up too much ressources.
Then some people I talked to thought it might be a good idea to dig into XML. I don't know much about it, but I might gather some info if any of you guys thinks it might be a good approach. From what I could understand, an XML file would act somehow as a database, straight in a "XML-formatted" text file. Q: Since I'm querying that 'word collection' ***VERY*** often, would that bring any drawbacks? ie speed.
My main goal is to keep the blazing fast results I'm getting right now by using those words STRAIGHT into the compiled vb app.
Thanks for any idea/thoughts on this!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|