Git Product home page Git Product logo

dom-monster's Introduction

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.

dom-monster's People

Contributors

rich-harris avatar trueadm avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.