allegro timer effeciency
A J

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 ?

miran

Uneducated guess: no to both questions.

HoHo

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.

Kitty Cat
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.

gillius

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

Thomas Fjellstrom

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.

Kitty Cat
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)

;)

Thomas Fjellstrom

Oops :)

Thread #514778. Printed from Allegro.cc