planjure icon indicating copy to clipboard operation
planjure copied to clipboard

Redraw only the difference on world update

Open elben opened this issue 11 years ago • 1 comments

The slow part about re-drawing the world (mostly noticeable on large world) is the tight loop through each element in world. What we need to do is only draw the difference.

So we can have a difference hash that only contains the updated rows/cols:

{row-idx-0 {col-idx-0 3
            col-idx-1 5 ...}
 row-idx-1 { ... }
 ...}

elben avatar Jul 29 '14 14:07 elben

The canvas component updates on :world changes. So doing a diff would be difficult. We also currently redraw the complete canvas every time. This makes it easy to not have to think about redrawing paths, etc.

Ideas:

  • Build a diff of :world with one in history. Would need to add history to app-state, perhaps.
  • Keep a :world-diff in the app state.
  • On path re-draw, we would need to also update the world tiles that were affected.

elben avatar Jul 30 '14 00:07 elben