252u3130@fergvax.unl.edu (Phil Dietz) (12/18/90)
I'm writing a program that does a BUNCH of calulations (3d ray trace stuff). Well as it turns out, if I put the calculation part of the program in a CASE INTUITICKS: loop, it runs 10% faster than if I just let it run (and not be multi-tasking happy!) Weird.... Now the problem is, if I use the INTUITICKS trap, the WINDOW ALWAYS HAS TO BE SELECTED!! If the window isn't selected it just hangs at the spot until I re-activate it. Whats going on? Is there a way around it? Phil Dietz --- University of Nebraska Phil Dietz // Computer Science 252u3130@fergvax.unl.edu \\// out the \/ Amiga!
jap@convex.cl.msu.edu (Joe Porkka) (12/18/90)
252u3130@fergvax.unl.edu (Phil Dietz) writes: >I'm writing a program that does a BUNCH of calulations (3d ray trace >stuff). Well as it turns out, if I put the calculation part of the >program in a CASE INTUITICKS: loop, it runs 10% faster than if I just >let it run (and not be multi-tasking happy!) Weird.... Hmm, not sure. Care to give more details? How do you decide how much calculation per intuitick? how were you doing it without intuiticks? > >Now the problem is, if I use the INTUITICKS trap, the WINDOW ALWAYS HAS >TO BE SELECTED!! If the window isn't selected it just hangs at the spot >until I re-activate it. Whats going on? Is there a way around it? INTUITICKS only happen in the active window. You can get input.device ticks, which are the ultimate source on intuiticks, by adding yourself as an input hanlder. NOTE: do as little as possible in an input-handler, else you can mess things up by slowing things down.
peter@cbmvax.commodore.com (Peter Cherna) (12/19/90)
In article <1990Dec17.220906.15730@hoss.unl.edu> 252u3130@fergvax.unl.edu (Phil Dietz) writes: >I'm writing a program that does a BUNCH of calulations (3d ray trace >stuff). Well as it turns out, if I put the calculation part of the >program in a CASE INTUITICKS: loop, it runs 10% faster than if I just >let it run (and not be multi-tasking happy!) Weird.... The system will take care of multitasking. You don't have to voluntarily give up the processor in order to be multitasking-friendly. The Amiga is a pre-emptive system, which means that after the right amount of time, your task will be pre-empted if someone else is ready to run. The key principle of being multi-tasking friendly is not to avoid being busy, but to avoid being busy doing nothing. So, if your program has work to do, do the work, but if you're waiting for some event (eg. a signal or a message), then use the Wait() or WaitPort() command, instead of running in a tight loop checking the condition. >Now the problem is, if I use the INTUITICKS trap, the WINDOW ALWAYS HAS >TO BE SELECTED!! If the window isn't selected it just hangs at the spot >until I re-activate it. Whats going on? Is there a way around it? INTUITICKS are only sent to the active window. You can set up requests with the timer.device that you'll hear all the time. But as explained above, you don't need this (at least not for the use you describe). >Phil Dietz Peter -- Peter Cherna, Software Engineer, Commodore-Amiga, Inc. {uunet|rutgers}!cbmvax!peter peter@cbmvax.commodore.com My opinions do not necessarily represent the opinions of my employer. "Oh, PIN-compatible! I thought you wanted me to make it IN-compatible!"