Page 2 of 2

Re: Performance Benchmarking

Posted: Sun Dec 04, 2022 9:43 pm
by UrbanCyborg
Nice approximation.

Reid

Re: Performance Benchmarking

Posted: Mon Dec 05, 2022 5:02 pm
by poetix
My understanding is that if I call Invalidate() on the canvas (e.g. when I detect a signal in ProcessSample() that means that something's changed), it'll get notified for redrawing the next time Notify() is called and I can respond to the Canvas_Painting event? I'm assuming that Notify() is getting called from some UI event loop thread quite independently of ProcessSample(), so the call to Invalidate() inside ProcessSample() doesn't result in the canvas being redrawn immediately (i.e. during the execution of ProcessSample() itself)?

Re: Performance Benchmarking

Posted: Mon Dec 05, 2022 7:17 pm
by ColinP
In principle yes, but the details of what's going on are obscure. Notify() isn't associated with any particular thread, instead it's like a switch nexus for multiple threads.

Tracking down what's going on in Notify() is something that I think many of us have been struggling to understand as in effect it can be being called by multiple threads "simultaneously" with no real information about thread safety mechanisms. My theory is that that Notify() doesn't have any.

I presume there is an event queue of some kind but who knows how events are actually dispatched as timers seem to be able to interrupt Notify().

To make matters worse it looks like handlers inside Notify() can possibly trigger recursive calls to Notify().

Basically simple modules work without any issues but once you start getting into multi-threading it becomes more and more mysterious.

Devising diiagnostic code to try to figure out what on earth is happening seems to be a highly evolved skill amongst more experienced VM devs.

Have fun!