Skip to content

trueadm/dom-monster

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dom-monster

The dbmonster benchmark has been widely used to compare various front-end frameworks and libraries. Andrew Giammarchi aka @WebReflection argues, in this post, that those tools are often unnecessary and often cause performance problems.

Personally, I wouldn't want to build an app without a suitable abstraction (cough Ractive cough), because your code becomes hellaciously complex surprisingly quickly if you try to rely on vanilla DOM. But Andrea makes a reasonable point that a vanilla DOM implementation serves as a useful benchmark against which to evaluate frameworks.

On Chrome on the machine I'm writing this on, his vanilla DOM implementation is actually slower than the Ractive implementation (though that's not true on every device or every browser). That's because Ractive implements various optimisations that no sane developer would bother with themselves. (Yep, abstractions can be faster than the thing they're abstracting, when the underlying primitives are sufficiently complex that we don't use them correctly.)

But what would the fastest possible vanilla DOM implementation look like?

Something like this, presumably

dom-monster is a fork of the Ractive implementation, without Ractive. It's really bad code, with lots of hardcoded assumptions (e.g. about the number of rows staying constant), and anyone who produced code like this would receive some stern words if they were working on the same team as me. But because the code doesn't make any attempt to be non-brittle, it's pretty fast.

This is the standard that those of us authoring tools should be aiming for. (I have to hand it to paperclip, which is within spitting distance of dom-monster.) Besides raw update performance, we should be aiming for the same degree of compatibility, initialisation speed, and memory footprint.

Theoretically, that's pretty much impossible, but it's still a useful target.

(Incidentally, Ractive is undergoing some changes for the upcoming 0.8 version that improve its update performance significantly - even beyond its current React/Underscore/Ember-beating performance. Yay!)

I bet I can make dom-monster faster

Please send me a PR!

License

MIT.

About

The fastest possible dbmonster implementation?

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 58.9%
  • HTML 35.9%
  • CSS 5.2%