2 ms·
A big factor here is that Mithril describes templates programmatically rather than strings of data. It's the difference between: function render() { eval("(f
by hajile 13y ago
A big factor here is that Mithril describes templates programmatically rather than strings of data. It's the difference between:
function render() { eval("(function () {}());"); }
and
function render() { (function () {}()); }
These are going to run at much different speeds because one involves parsing multiple times while the other only needs to be parsed once. The tradeoff is some complexity (though there's also more flexibility too).
<ul class="foo">
<li data-ng-repeat="item in items">
{{item.x}}
</li>
</ul>
m("ul.foo", [
items.map(function (item) {
m("li", item.x);
});
]);
- lhorie 13y agoYep. I'd argue that Angular is far more complex though, with its `track by $index` and `ng-repeat-start`/`ng-repeat-end` and the scoping implications of caching filtered expressions in the view and the `ng-init` watcher trap and all that. But I digress.