1
1
var _ = require ( 'underscore' ) ,
2
2
runner = require ( './util/template-runner' ) ,
3
- templates = require ( './templates' ) ,
4
3
5
4
eco , dust , Handlebars , Mustache , eco ;
6
5
7
6
try {
8
- dust = require ( " dustjs-linkedin" ) ;
7
+ dust = require ( ' dustjs-linkedin' ) ;
9
8
} catch ( err ) { /* NOP */ }
10
9
11
10
try {
12
- Mustache = require ( " mustache" ) ;
11
+ Mustache = require ( ' mustache' ) ;
13
12
} catch ( err ) { /* NOP */ }
14
13
15
14
try {
16
- eco = require ( " eco" ) ;
15
+ eco = require ( ' eco' ) ;
17
16
} catch ( err ) { /* NOP */ }
18
17
19
18
function error ( ) {
20
- throw new Error ( " EWOT" ) ;
19
+ throw new Error ( ' EWOT' ) ;
21
20
}
22
21
23
22
function makeSuite ( bench , name , template , handlebarsOnly ) {
@@ -34,19 +33,19 @@ function makeSuite(bench, name, template, handlebarsOnly) {
34
33
mustacheOut ;
35
34
36
35
var handlebar = Handlebars . compile ( template . handlebars , { data : false } ) ,
37
- compat = Handlebars . compile ( template . handlebars , { data : false , compat : true } ) ,
36
+ compat = Handlebars . compile ( template . handlebars , { data : false , compat : true } ) ,
38
37
options = { helpers : template . helpers } ;
39
- _ . each ( template . partials && template . partials . handlebars , function ( partial , name ) {
38
+ _ . each ( template . partials && template . partials . handlebars , function ( partial ) {
40
39
Handlebars . registerPartial ( name , Handlebars . compile ( partial , { data : false } ) ) ;
41
40
} ) ;
42
41
43
42
handlebarsOut = handlebar ( context , options ) ;
44
- bench ( " handlebars" , function ( ) {
43
+ bench ( ' handlebars' , function ( ) {
45
44
handlebar ( context , options ) ;
46
45
} ) ;
47
46
48
47
compatOut = compat ( context , options ) ;
49
- bench ( " compat" , function ( ) {
48
+ bench ( ' compat' , function ( ) {
50
49
compat ( context , options ) ;
51
50
} ) ;
52
51
@@ -61,8 +60,8 @@ function makeSuite(bench, name, template, handlebarsOnly) {
61
60
62
61
dust . render ( templateName , context , function ( err , out ) { dustOut = out ; } ) ;
63
62
64
- bench ( " dust" , function ( ) {
65
- dust . render ( templateName , context , function ( err , out ) { } ) ;
63
+ bench ( ' dust' , function ( ) {
64
+ dust . render ( templateName , context , function ( ) { } ) ;
66
65
} ) ;
67
66
} else {
68
67
bench ( 'dust' , error ) ;
@@ -75,11 +74,11 @@ function makeSuite(bench, name, template, handlebarsOnly) {
75
74
76
75
ecoOut = ecoTemplate ( context ) ;
77
76
78
- bench ( " eco" , function ( ) {
77
+ bench ( ' eco' , function ( ) {
79
78
ecoTemplate ( context ) ;
80
79
} ) ;
81
80
} else {
82
- bench ( " eco" , error ) ;
81
+ bench ( ' eco' , error ) ;
83
82
}
84
83
}
85
84
@@ -90,11 +89,11 @@ function makeSuite(bench, name, template, handlebarsOnly) {
90
89
if ( mustacheSource ) {
91
90
mustacheOut = Mustache . to_html ( mustacheSource , context , mustachePartials ) ;
92
91
93
- bench ( " mustache" , function ( ) {
92
+ bench ( ' mustache' , function ( ) {
94
93
Mustache . to_html ( mustacheSource , context , mustachePartials ) ;
95
94
} ) ;
96
95
} else {
97
- bench ( " mustache" , error ) ;
96
+ bench ( ' mustache' , error ) ;
98
97
}
99
98
}
100
99
0 commit comments