My gamelan emulation app Midi Gender shows terrible timing lags if retina is on. Compiled with 2018r4 it gets a bit better, but is still far from good. On my MacBookPro 13" early 2015 I can't see this behaviour, anything that can be done? Setting resolution to low can't be the solution..
@Otmar K I've done a lot of optimisations when retina came mandatory, and as I've stated, it's working fine on my older MBP, just the new more powerful MBP 2018 seem not to like the picture drawing...
It appears to me that you're double buffering an already double buffered interface (which may or may not actually be triple buffered). For best performance you *should* be drawing directly to the canvas.
I see in the next code snippet, you're recreating images, don't do that unless you absolutely need to. Each time you create a new image, it has to allocate memory for it, populate it and so on. Re-use the images as much as possible. The OS will automatically cache images for drawing a second time, so if you can re-use the same image (without modification to the image) the drawing will be faster.
@Otmar K But my question is: why is it so much slower on the new MBP?
You'd have to ask Tim Cook. Earlier this year I bought a 2017 15" MacBook Pro with TouchBar, I knew this machine should be faster than my 8 year 15" MBP, but it didn't feel that way. Sure Geekbench showed it being faster, but in reality it just didn't 'feel' faster (I know that's subjective), it was just one of the many reasons as to why I returned it after 4 days.
@Otmar K Maybe Xojo is not really the language to do realtime code and I'll have to port it to obj C or Swift....
Xojo's graphics performance is really close to what you'd get with Obj-C or Swift, IMHO it comes down to a couple of things.
- Have you tried other graphics apps on the new MBP, maybe it's faulty or it really is just a gimped machine designed for web browsing?
- The implementation probably has something to do with it.
The screenshots show the instruments inside of groupboxes, I vaguely remember something (but can't find it now) about there's some bugs with them on Mojave. Try removing them.
You could also try using a different canvas for each key of the instrument, although invalidate *should* only signal to the macOS that a section of the canvas needs recopying to the graphics card.