benmills/robotskirt — pull request #21 by jmendeth (2012-09-06 17:56:42+00:00)
Title: Merge v2 (unstable) into master [incomplete]

## Intro / Presentation

After hours, **days**, **WEEKS**, **M O N T H S** of work (yeah, I'm exagerating a bit),
the new, **flaming**, **FASTER** version 2 of Robotskirt is now stable,
and soon it'll be finished and ready to push to [NPM](http://npmjs.org).

As [GitHub itself does](https://github.com/blog/1124-how-we-use-pull-requests-to-build-github), I'm opening this pull request earlier.
Feel free to **post any suggestions or feedback** about the new version here!
Watch this pull request to stay updated on the v2 status and new features.
When we're ready to go, it'll be finally merged and published.

_What_ is still left to do, you ask?

## What is still left to do (and differences over v0-1)

![Done](http://i.imgur.com/CDLku.png) **Update to the latest Sundown** (at the time of writing, it is vmg/sundown@b6b58da3ff)

![Done](http://i.imgur.com/CDLku.png) **Consistent, structured, [faster](#performance) API** with **reusable PARSERS** in addition to renderers.

![In progress](http://i.imgur.com/lQE06.png) Update the **README**, benchmark results (see [below](#performance)) and `package.json`.

![Done](http://i.imgur.com/CDLku.png) **Custom renderers!**

![Pending](http://i.imgur.com/e6o4B.png) **Add a convenience, faster method** to build a standard Renderer/Parser pair in-one-step.

**Asynchronous versions of the methods.** There's discussion on if we should add them. Because Sundown rendering takes such a short time... it's faster to wait one millisecond, than to assume all the time loosed in events and the lot.

![In progress](http://i.imgur.com/lQE06.png) **Switch to Node-GYP** (to support latest versions also)

![In progress](http://i.imgur.com/lQE06.png) **Document the API** and **write some samples**

![Pending](http://i.imgur.com/e6o4B.png) **Expose [SmartyPants](http://daringfireball.net/projects/smartypants) and [Houdini](https://github.com/vmg/houdini)** (which are bundled with Sundown and Redcarpet).

![Pending](http://i.imgur.com/e6o4B.png) **Expose the other Sundown renderers**

![Pending](http://i.imgur.com/e6o4B.png) **Use [Travis.ci](http://travis-ci.org)** to test & benchmark.

![Done](http://i.imgur.com/CDLku.png) **Write a [manual page](https://github.com/benmills/robotskirt/blob/unstable/man/robotskirt.1)!** See [the screenshot](http://i.imgur.com/du02L.png).

In addition to that, the utilities I wrote for Robotskirt are now
an independent project called [V8U](https://github.com/jmendeth/v8u).
It's under the 2-clause BSD, feel free to use it in your addons!

## Performance

With the arrival of version 2, we are seeing a **tremendously faster** addon.
Currently, the benchmark (`node benchmark/index --bench`) outputs this:

#### Version 1 (`master` @ 1054ad19010)

```
robotskirt (reuse renderer) completed in 1678ms.
robotskirt (new renderer) completed in 1714ms.
marked completed in 3939ms.
discount completed in 5741ms.
'build' finished successfully (2.383s)
```

#### Version 2.3.1 (`unstable` @ e60131f3896)

```
robotskirt (reuse all) completed in 1350ms.
robotskirt (new renderer and parser) completed in 3796ms.
'build' finished successfully (2.312s)
```

Tests were run with Node `v0.8.8` (currently the latest stable release)
on a Lenovo Thinkpad T400 (Intel Centrino 2).

As you can see, reusing everything gives **1350** vs. **1678** milliseconds. (+25%)
On the other hand, a single render (including the time to construct the renderer and parser)
now takes **3.8ms** average. (1.7ms before: 2.24x slower)