GithubHelp home page GithubHelp logo

benchmark's Introduction

Monkberry

npm Build Status

Monkberry is blazingly fast, small 1kb and simple JavaScript library for building web user interfaces.

Example

Monkberry comes with powerfull templating engine, which is compiled to JavaScript.

<ol>
  {% for todos %}
    <li>
      {% if complete %}
        <del>{{ text }}</del>
      {% else %}
        <em>{{ text }}</em>
      {% endif %}
    </li>
  {% endfor %}
</ol>

and then

import Monkberry from 'monkberry';
import Template from 'template.monk';

const view = Monkberry.render(Template, document.body);

view.update({todos: [...]});

Features

  • Small 1kb minified & gzipped
  • Simple, small learning curve
  • Fully tested
  • Precompiled templates
  • Source maps
  • Custom tags
  • Blazingly fast (only necessary dom updates)

Documentation

Documentation available on monkberry.js.org site.

Development

If you want to hack on Monkberry, the first step is to fork the repo.

# Build compiler
npm run build

# Build parser
npm run build:parser

# Watch changes and rebuild
npm run watch

# Start tests server
testem

Plugins

Performance

Benchmarks

Why is Monkberry so fast? Even in comparison with React, Monkberry is 10 times faster, sometimes 100 times faster. It's because Monkberry will do only necessary dom updates, and does it in a completely different way than React does. Monkberry compiles template to plain JavaScript to gain an advantage by using v8 hidden classes and reduce call stack. There is no virtual dom (in general, an react app have to keep 3 virtual doms), for example next template will be generated to JavaScript code which will do only necessary dom updates on state changes.

<div>
  ...
    <h1>{{ title }}</h1>
  ...
</div>

Will be compiled to code like this:

function (state) {
  h1.textContent = state.title;
}

Benchmarks covers a few use cases and compares Monkberry with React and innerHTML. Also, it contains real site code and data.

License

The MIT License (MIT) Copyright © 2016 Medvedev Anton

benchmark's People

Contributors

antonmedv avatar pedroborges avatar trueadm avatar yyx990803 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

benchmark's Issues

Use React in production mode

Turn off debugging and dev warnings by setting process.env.NODE_ENV to production. It will make React much faster in the benchmarks.

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.