jsguy/misojs

Sugartags waste Mithril's tag cache

Satyam opened this issue · 2 comments

Mithril keeps a cache of created nodes indexed by the first argument to the m method. The more constant attributes you can pile up in the first argument, the best.

This: m('.item') is best than m('div', {class:'item'}) because in the first case Mithirl will clone a div node with the class attribute already set while in the second it will clone a generic div and then waste time adding the class attribute.

Hmmm interesting - I'll see if I can optimise on that, thanks! 👍

I've added a task for this in the sugartags project:

jsguy/mithril.sugartags#5

So I'll close this for now.