New topic: Cocoa and performance
<http://forums.realsoftware.com/viewtopic.php?t=47537> Page 1 of 1 [ 2 posts ] Previous topic | Next topic Author Message by-gum Post subject: Cocoa and performancePosted: Mon Apr 08, 2013 12:37 am Joined: Thu Jan 05, 2006 1:44 am Posts: 5 Location: Australia Hi all, I suppose I am looking for some re-assurance. I have been a Mac fan since I bought one of the first Classics in 1984. I am now retired and use my Mac for developing programs as a hobby. One program I produced some time ago was a real-time animation of a midi-file. I used it to "learn" RealBasic and introduced quirks like "steam" from the pipe instruments (with a "smoke puffs" credit to Joe Strout who got me hooked with his excellent "Three Ways to Animate in REALbasic"). One early criterion I set myself was to use "basic" RB and I even managed to implement pitch bend with the NotePlayer. (No disrespect to midiMBSPlayer, which I also use.) In order to get the necessary performance out of my then PowerPC, I used graphics.window and graphics.canvas, etc but then I had to change it to use only paint events. That was when I invented the acronym "Rather Excessive And Laborious Booleans As Semaphores In Canvases . Again, to get the necessary performance - mainly so as not to miss the animation of ANY note-on and note-off events - I needed copious refreshrects of the smallest areas I could get away with, and resorted to using a microsecond-based loop for timing and therefore a thread to update the GUI. Obviously, I had to take care to ignore unsolicited and unexpected paint events! An interesting exercise, with 4 different types of musical instrument animation. So now we have Cocoa on the horizon so I recently "bit the bullet", removed the threads and now use a timer for the wait between midi events. I am happy to say my concerns over the accuracy of the built-in timers were unfounded but of course I still need all the help the refreshrects, etc. give me. Imagine my satisfaction when it all worked within an hour or two and I am still in awe of the software development features of RS. BUT imagine my disappointment when I set Cocoa in the Build options and got appalling performance. Not only subjectively - with obvious audio glitches but also objectively - I have a custom control showing the current over-run in msecs. This is the time gap between where I am in the midi-file and the elapsed real-time. Under Carbon, the overrun in my test midi is negligible - but with Cocoa, it is regularly "in the red zone". I can switch animation off, and doing so enabled me to confirm that it is indeed the graphics that is solely to blame. Incidentally, the performance hit was about the same as when I briefly toyed with Mountain Lion. Is there a connection? Where do I go from here? I suppose I am fortunate and I have the option of staying with Snow Leopard and RS 2012 R2.1 - but am I the only one who finds all this very frustrating? I hope someone can show me that I should hang on and that things will get better. I cannot afford to replace my Mac with the next most powerful offering - just to hide the growing OS overheads. Help? _________________ OSX v10.6.8 2.66 GHz Core2Duo 4GB Bill Top shaosean Post subject: Re: Cocoa and performancePosted: Mon Apr 08, 2013 1:13 am Joined: Mon Aug 15, 2011 10:25 pm Posts: 277 While you are not able to update the canvas (or any of the GUI) from a thread, is there any reason one could not draw a picture in the thread, save it to a property of the canvas and let the canvas use that picture from its paint event? _________________ Real Studio 2012r1.1 | MacBook Pro i5, 10.6.8 | Windows 7 Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 2 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
