3 ms·
Gc pauses suck the "magic" out of interactive programs. The great thing about obj-c is that it I trivial to have a c array of vanilla c structs, so your perfor
by aaronblohowiak 15y ago
Gc pauses suck the "magic" out of interactive programs. The great thing about obj-c is that it I trivial to have a c array of vanilla c structs, so your performance sensitive code is still slim and hot. (size and cache locality.)
My iOS audio programming mixes c for audio processing and obj-c for ui and control quite effectively.
- rwmj 15y agoI didn't say that GC was free ... malloc has overhead too. For interactive programs, I would recommend two things to avoid (or hide) the pauses. Firstly schedule calls which run the GC when it won't be noticed: between frames in an arcade-style game, or just before accepting user input in a turn-based game. Secondly, size the minor heap large enough so that all computation between the scheduled GC runs can happen without invoking a minor sweep (but not too large that the minor heap is wasting memory -- some experimentation and tuning required). I've written a couple of interactive games in OCaml that used this strategy and avoided visible GC pauses.