Click here to Skip to main content
15,917,808 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: A Return to VB Email Pin
Dave Kreskowiak8-Apr-09 13:26
mveDave Kreskowiak8-Apr-09 13:26 
GeneralRe: A Return to VB Email Pin
Dalek Dave8-Apr-09 13:50
professionalDalek Dave8-Apr-09 13:50 
GeneralRe: A Return to VB Email Pin
Christian Graus8-Apr-09 14:31
protectorChristian Graus8-Apr-09 14:31 
GeneralRe: A Return to VB Email Pin
Dave Kreskowiak8-Apr-09 17:28
mveDave Kreskowiak8-Apr-09 17:28 
GeneralRe: A Return to VB Email Pin
Dalek Dave8-Apr-09 21:27
professionalDalek Dave8-Apr-09 21:27 
QuestionWhy is this loop intermittently slow? Pin
Steve Faust8-Apr-09 11:56
Steve Faust8-Apr-09 11:56 
AnswerRe: Why is this loop intermittently slow? Pin
Luc Pattyn8-Apr-09 12:40
sitebuilderLuc Pattyn8-Apr-09 12:40 
AnswerRe: Why is this loop intermittently slow? Pin
Dave Kreskowiak8-Apr-09 12:41
mveDave Kreskowiak8-Apr-09 12:41 
The code isn't taking exactly 15.627 milliseconds every time it "fails". Unless you're using the high resolution timers, this is the minumum resolution of the timing method you're using.

The problem you have is that you're using 570 different compares against a single word. You need to turn this around and make it so you can do a lookup of the one word on a known list, if at all possible.

Another possibility would be to pre-test the single word to narrow it down to a small number of filters that might apply. If you have a word that starts with a letter, there's no sense in testing a bunch of rules that all start with a number.

But, in the end, it sounds like your code is being stopped by the Garbage Collector while it does it's work. Normally, the GC will stop all threads in your process, walk the object graph looking for things to collect, do it's cleanup work, then resume your threads. Depending on the app, this can take a couple dozen milliseconds, making it look like your code hung for a brief time.

Why is thing happening?? Well, since you're obviously parsing out individual words, you're creating String object after String object, one for each and every word you test. These String objects are dropping out of scope at some point, and the GC has to spend time cleaning them up every once in a while.


A guide to posting questions on CodeProject[^]



Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007, 2008




GeneralRe: Why is this loop intermittently slow? [modified] Pin
Steve Faust8-Apr-09 12:45
Steve Faust8-Apr-09 12:45 
QuestionSend email in VB Pin
Dalek Dave8-Apr-09 3:50
professionalDalek Dave8-Apr-09 3:50 
AnswerRe: Send email in VB Pin
Dave Kreskowiak8-Apr-09 4:25
mveDave Kreskowiak8-Apr-09 4:25 
AnswerRe: Send email in VB Pin
Jay Royall8-Apr-09 4:27
Jay Royall8-Apr-09 4:27 
QuestionMotion detection VB6 Pin
obi_wan8-Apr-09 1:56
obi_wan8-Apr-09 1:56 
AnswerRe: Motion detection VB6 Pin
EliottA8-Apr-09 3:17
EliottA8-Apr-09 3:17 
AnswerRe: Motion detection VB6 Pin
Dave Kreskowiak8-Apr-09 3:32
mveDave Kreskowiak8-Apr-09 3:32 
Questionhow to add url to vb6.0 desktop application in button click Pin
premprakashbhati8-Apr-09 0:12
premprakashbhati8-Apr-09 0:12 
AnswerRe: how to ask a proper question Pin
Ashfield8-Apr-09 1:30
Ashfield8-Apr-09 1:30 
GeneralRe: how to ask a proper question Pin
premprakashbhati8-Apr-09 1:57
premprakashbhati8-Apr-09 1:57 
GeneralRe: how to ask a proper question Pin
Dave Kreskowiak8-Apr-09 3:23
mveDave Kreskowiak8-Apr-09 3:23 
GeneralRe: how to ask a proper question Pin
Ashfield8-Apr-09 5:53
Ashfield8-Apr-09 5:53 
Questionin crystal report Pin
rajancbe7-Apr-09 23:31
rajancbe7-Apr-09 23:31 
AnswerRe: in crystal report Pin
Anubhava Dimri8-Apr-09 0:34
Anubhava Dimri8-Apr-09 0:34 
QuestionHow to Set Trial Days Limitation in GUEST Accout Pin
Anubhava Dimri7-Apr-09 21:10
Anubhava Dimri7-Apr-09 21:10 
AnswerRe: How to Set Trial Days Limitation in GUEST Accout Pin
Eddy Vluggen7-Apr-09 21:53
professionalEddy Vluggen7-Apr-09 21:53 
GeneralRe: How to Set Trial Days Limitation in GUEST Accout Pin
Anubhava Dimri7-Apr-09 23:22
Anubhava Dimri7-Apr-09 23:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.