> Indeed, I completely agree that the sleep() will help. I just got out of an
> operating systems class this semester, so I'm probably hypersensitive to
> busy-waits and threading right now. Maybe my best choice is to hack up a
> solution, move on, and fix the performance issues in the next version.
>
> My previous example of checking LV6 images for mouseclicks is again a
> fitting example because LV-profiler said it's a very expensive operation
> timewise. As you describe, the impact can be very low. However with
> expensive reads, lots of reads, and tons of threads sucking down
> processor-time then the whole mess becomes non-negligible. Even 1/4 to 1/2
> of a second for the loop is a lifetime since users get frustrated if there
> is no visual response within about 1.5 or 2 seconds of clicking on anything.
>
> It indeed sucks to be working on a fancy multi-threaded labview program and
> then get tripped up by the controls, but maybe LV just can't do such a
> thing... One can always hope that NI pays attention to the newsgroup and
> will add it in LV7 though! Thanks for your comments. If you can think of
> anything else helpful definately let me know.
>
Busy-waits are often made out to be the bad guy since when implemented
badly, they can really affect performance of the system. On the
otherhand, badly implemented interupt drivers or event handlers can ruin
performance too. If you are seeing bad performance according to the
task manager or profiler, then describe what the symptom is and how that
part of the app are written. People on this forum can probably offer
insight into how it can be fixed. If the performance is fine and the
code is correct, then maybe it doesn't need to be rewritten?
My point is that in LV right now, some things are expensive, others are
cheap. LV is sent events from the OS each time the mouse moves, and
more code is executed determining what the cursor should be than is
spent properly reading and comparing some Booleans looking for a value
change. User interface events will be nice to have, but in my opinion,
for reasons other than performance. In the midst of your OS class, they
brought up sleep() because it is an important tool, just like interrupts
and events. Polled systems will probably always be with us. In fact,
USB is new and incredibly popular, but is it interrupt driven? Nope,
the devices are polled because it simplifies the bus, allows for cheaper
HW and keeps things orderly.
As for NI paying attention, myself and many other NI employees
participate in this list. It is one of the best ways for us to gather
feedback and ideas for new products.
Greg McKaskle