AND51 wrote:Thank you! Very interesting!
So if I createa threaad, the thread can start faster, if I've got a Delay(0) in my main module? And if there is no thread is to be started, my main module wouldn't be influcened, because Delay(0) immediately returns...
Pretty much yeah!
But even if you do not use multiple threads, it is still advised to do it in loops you know are "heavy" (use a lot of cpu, or takes a while to complete)
The machine will seem to work smoother. (users will be able to browse the net or watch a movie while they wait for the program to complete whatever it's doing)
Best of all, using Delay(0) in loops (while/for/foreach and similar) while developing a program is smart too,
if the loop is buggy you will still be able to bring up Task Manager or Kill it from the IDE.
So I recommend using Delay(0) in any application at the least,
preferably Delay(1) in the main window loop,
for "paused" programs I tend to use Delay(1000) (actualy WaitWindowEvent(1000) is what I use then instead)
I would not recommend using more than Delay(20) in a GUI loop if you use WindowEvent(), longer delays than 20ms makes the GUI very "sluggish".
Anyway, I'm getting totally off topic from the original posts here, sorry.

Maybe WaitWindowEvent(1000) and Delay(0) and Delay(1) should be added to the PB manual's Window and loop sections as "tips",
or add it to the FAQ or somewhere. veterans are aware of this (I hope) as it's considered good coding/multitask friendly coding and will benefit single cpu's as well as multi-cpu systems.
Beginner coders are not always aware of easy performance "tricks" like this. Remember, a program runs under a operating system so you must not consider only the performance of your program, but how your program affect the performance of the OS while running as well.
(PS! if anyone want to, feel free to "steal" my blabber above/rewrite it and post it as a Tips'n'tricks post or similar.)