mchakravarty / HaskellSpriteKit

Haskell binding to Apple's SpriteKit framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Strictness in node data type

mchakravarty opened this issue · comments

At the moment, it makes no sense to make the fields of Node components strict as we exploit laziness for lazy marshalling back to Haskell. However, the following would be even better.

  • Make all Node components strict (at least those of elementary type, but maybe also some frequently modified ones of Point, Rect, and so on types).
  • Marshal all strict components eagerly from ObjC to Haskell (in one foreign call!) and keep the rest being marshalled lazily.
  • Set the eagerly marshalled components on the ObjC object only if they changed in the Haskell world (using comparisons on the elementary types, rather than on thunk references).
  • Do the same for Scene. (Maybe even do it first for Scene.)

This balances thunk creation and entering overhead with the overhead of marshalling elementary values that are not ending up being changed.