Hi All,
I'm currently working on a ambitious and big project with several timers on each form. Does having too many timers doing different things cause bottlenecks because I'm getting unexpected behavior and things either don't fire off or end up way slower than they should be. I guess what I'm asking is how exactly do multiple timers on a form work? I could be totally wrong here and the weird behavior isn't being caused by the timers but that's just what I'm suspecting at the moment. Is there a better way than timers to handle all the things needing to be done in the background? Would dividing up all timers into their own forms (and then hiding them) work? Thanks for any input.
Lots of Timers Question
- BruceSteers
- Posts: 1579
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Lots of Timers Question
check out Task.class
http://gambaswiki.org/wiki/comp/gb/task
a timer is not a true "background task" timer code will still be run synchronously so each timer trigger running is like a normal function that your program runs (one at a time through the event loop)
for true background tasks use Task.class
http://gambaswiki.org/wiki/comp/gb/task
a timer is not a true "background task" timer code will still be run synchronously so each timer trigger running is like a normal function that your program runs (one at a time through the event loop)
for true background tasks use Task.class
If at first you don't succeed , try doing something differently.
BruceS
BruceS
- cogier
- Site Admin
- Posts: 1127
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: Lots of Timers Question
You are asking a lot of questions, but to help we would need more details.
What Delay are you putting on your timers?
What are the timers doing, if they are working out the nth Prime Number it may well be slow?
Gambas only uses one of your processor cores to run unless you use Task as Bruce has pointed out. Have a look at this post that may help. I was able to get all 8 cores running in Gambas.
What Delay are you putting on your timers?
What are the timers doing, if they are working out the nth Prime Number it may well be slow?
Gambas only uses one of your processor cores to run unless you use Task as Bruce has pointed out. Have a look at this post that may help. I was able to get all 8 cores running in Gambas.
Re: Lots of Timers Question
Thanks Bruce, I'll check out Tasks. Probably what I'm looking for. Cogier, sorry for so many questions. The timers have various delays...1, 2, 5 seconds etc. Most of the timers are just using HttpClient to grab data from a server then depending on what is returned, doing something with that data like putting that data on a Label on the form or showing another form or even playing a video or an .ogg music file as well as several other things. I'll check out the link you posted. Thanks guys!
Re: Lots of Timers Question
I've been testing different things the last couple hours. It sure seems like I have too many timers doing too many things. I think since it's such a large app I'll just divide it up into smaller individual apps and figure out a way to get them to work together and communicate when needed. Thanks Bruce and cogier for your input!