[racket-users] Re: canvas% mouse event handling difference in Racket CS?

2021-05-22 Thread schle...@gmail.com
I tried your flag version too, I like it, it works without delay and is simple. But theoretically you can have situations where the drawn output doesn't fully represent the current state (if some things were already done and the data was changed afterwards). Unless I misunderstand your

[racket-users] Re: canvas% mouse event handling difference in Racket CS?

2021-05-22 Thread Alex Harsányi
On Saturday, May 22, 2021 at 12:42:30 PM UTC+8 schle...@gmail.com wrote: > Maybe someone has a clever solution to collapse the calls to refresh less > manually. > I experienced a similar problem as you, where I have to refresh a canvas on a mouse event and the paint method is somewhat slow

[racket-users] Re: canvas% mouse event handling difference in Racket CS?

2021-05-22 Thread schle...@gmail.com
The difference between 23ms and 50ms was that the memoization wasn't doing its job. I removed some calls to get-brush and set-brush, only calling set-brush when the color changes. (only writing the value not reading it) Specialized a function that returned an ignored argument, to not calculate

[racket-users] Re: canvas% mouse event handling difference in Racket CS?

2021-05-21 Thread schle...@gmail.com
I tested with Racket v7.8 bc and it was also slow. I also tested it with a year old version of my code and added similar `time` calls around the drawing code and it behaved like the recent version redrawing for all the mouse events, only difference is that the on-paint takes around 23ms instead