chjj/zest — Issue #1: RegExp creation
Author: arexkun
Created: 2011-10-30 18:59:57+00:00
State: open

One thing that I think could help speed up zest is to assign regular expressions used as variables within the closure, and then reference them where they're needed.

Example (L55)

```javascript
$ = /^([+-])?(\d+)?n([+-])?(\d+)?$/.exec($);
```
A variable (such as r_nth) can be declared at the top of the closure (where document and window are defined)

```javascript
var window = this
, document = this.document
, r_nth = /^([+-])?(\d+)?n([+-])?(\d+)?$/;
```

...and then be used as such:

```javascript
$ = r_nth.exec($);
```

The following jsperf shows that it's a little faster to use this method (and every little bit helps)
http://jsperf.com/regexp-creation