How about Haskell's GC performance for soft realtime application like games?
Because I realized game rule logic should handle huge complexity, I'm considering using of non-typical language in game field as in-game logic script language. The reason of in-game script is representing complex logic with less code. So extremely well abstracted langu开发者_JS百科age required.
But most well-abstracted languages use GC. And normally the GCs make CPU burst load. Basically it defers clearing memory operation, and do it at once. Really critical to realtime graphics including games and GUI.
AFAIK, Haskell's GC is little bit different with other GC based languages cause of it's immutable attribute. It's hard to imagine. I couldn't find any document this in detail.
What's different? And is it CPU burst free for long running programs? (well distributed load over time, manual complete GC command can be called for each tick)
You may want to look at the thread initiated by Luke Palmer here : http://www.haskell.org/pipermail/haskell-cafe/2010-February/thread.html#73881
You may be interested in this blog post by Simon Marlow about moving GHC from stop-the-world collection to something more concurrent with pause times more suitable for soft real-time applications such as games.
I haven't benchmarked GHCs latency profile myself but, as I understand it, those 0.0007ms pause times may seem small but they are proportional to the heap size which is tiny for that toy tic-tac-toe program so real heaps and pause times will be orders of magnitude larger.
You might be interested in the commercial Haskell game, Nikki and the Robots, released in 2011 by Joyride Labs.
They don't seem to be having any trouble with having a garbage collector.
精彩评论