Core Topics
--
-
- Installation -
- Getting Started -
- Routing -
- Web Services -
- Components -
Advanced Topics
- -Misc
- -Core Topics
+-
+
- Installation +
- Getting Started +
- Routing +
- Web Services +
- Components +
Advanced Topics
+ +Misc
+ +The Auto-Redrawing System
Mithril is designed around the principle that data always flows from the model to the view. This makes it easy to reason about the state of the UI and to test it. In order to implement this principle, the rendering engine must run a redraw algorithm globally to ensure no parts of the UI are out of sync with the data. While at first glance, it may seem expensive to run a global redraw every time data changes, Mithril makes it possible to do this efficiently thanks to its fast diffing algorithm, which only updates the DOM where it needs to be updated. Because the DOM is by far the largest bottleneck in rendering engines, Mithril's approach of running a diff against a virtual representation of the DOM and only batching changes to the real DOM as needed is surprisingly performant.
In addition, Mithril attempts to intelligently redraw only when it is appropriate in an application lifecycle. Most frameworks redraw aggressively and err on the side of redrawing too many times because, as it turns out, determining the best time to do a redraw is quite complicated if we want to be as efficient as possible.
@@ -135,18 +135,18 @@ var doBoth = function(callback) { }); }; - -