Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » allegro timer effeciency

This thread is locked; no one can reply to it. rss feed Print
allegro timer effeciency
A J
Member #3,025
December 2002
avatar

do the allegro timers create much overhead ?
if i dont use them at all could i expect much better timing in the rest of the app ?

___________________________
The more you talk, the more AJ is right. - ML

miran
Member #2,407
June 2002

Uneducated guess: no to both questions.

--
sig used to be here

HoHo
Member #4,534
April 2004
avatar

Since Allegro timers use threads and are executed at most as fast as OS swiches tasks then I think they might not be the best thing to time stuff. Afaik on XP and most *nixes timers run around evert 10msec at most, not much faster. The speed impact they have is probably quite small unless you have vast amount of timers updating hudreds of times per second.

If all you need is some number that automatically gets incremented as fast and accurately as possible then best bet would be to use system specific things like gettimeofday and query_performance counter.

[edit]
It's somewhat-educated guess. I haven't done exact timings but allegro timers didn't give me enough precision for profiling so I used alternatives I said earlier.

__________
In theory, there is no difference between theory and practice. But, in practice, there is - Jan L.A. van de Snepscheut
MMORPG's...Many Men Online Role Playing Girls - Radagar
"Is Java REALLY slower? Does STL really bloat your exes? Find out with your friendly host, HoHo, and his benchmarking machine!" - Jakub Wasilewski

Kitty Cat
Member #2,815
October 2002
avatar

Quote:

if i dont use them at all could i expect much better timing in the rest of the app ?

If you don't ever call install_timer, or call anything that needs a timer (keyboard, mouse, sound, midi.. anything that processes in the background), then you'll probably save on the creation of a thread. Though it won't do much for performance since the thread is going to be sleeping more often than not, anyway. All the other background processes are going to have a significantly bigger impact than that one thread.

In otherwords, the savings would be negligible.

--
"Do not meddle in the affairs of cats, for they are subtle and will pee on your computer." -- Bruce Graham

gillius
Member #119
April 2000

Allegro's timers on Win32 are very inaccurate but do have a low overhead.

Gillius
Gillius's Programming -- https://gillius.org/

Thomas Fjellstrom
Member #476
June 2000
avatar

Hmm, doesnt the keyboard driver use a timer? I'm pretty sure that the timer system is inited even if you dont ask it to.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Kitty Cat
Member #2,815
October 2002
avatar

I said:

If you don't ever call install_timer, or call anything that needs a timer (keyboard, mouse, sound, midi.. anything that processes in the background)

;)

--
"Do not meddle in the affairs of cats, for they are subtle and will pee on your computer." -- Bruce Graham

Thomas Fjellstrom
Member #476
June 2000
avatar

Oops :)

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Go to: