@@ -25,148 +25,181 @@ function runTimes(compiler, times, deferred) {
25
25
}
26
26
27
27
var tests = {
28
- "normal build" : [ [ 0 , 1 , 5 , 10 , 50 , 100 , 200 ] , function ( size , deferred ) {
29
- webpack ( {
30
- context : fixtures ,
31
- entry : "./" + size + ".js" ,
32
- output : {
33
- path : outputPath ,
34
- filename : "bundle.js"
35
- }
36
- } , function ( err , stats ) {
37
- if ( err ) throw err ;
38
- deferred . resolve ( ) ;
39
- } ) ;
40
- } ] ,
41
- "eval dev build" : [ [ 0 , 1 , 2 , 5 , 10 , 15 ] , function ( size , deferred ) {
42
- webpack ( {
43
- context : fixtures ,
44
- entry : "./" + size + ".big.js" ,
45
- output : {
46
- path : outputPath ,
47
- filename : "bundle.js"
48
- } ,
49
- devtool : "eval"
50
- } , function ( err , stats ) {
51
- if ( err ) throw err ;
52
- deferred . resolve ( ) ;
53
- } )
54
- } ] ,
55
- "sourcemap build" : [ [ 0 , 1 , 2 , 5 , 10 , 15 ] , function ( size , deferred ) {
56
- webpack ( {
57
- context : fixtures ,
58
- entry : "./" + size + ".big.js" ,
59
- output : {
60
- path : outputPath ,
61
- filename : "bundle.js"
62
- } ,
63
- devtool : "source-map"
64
- } , function ( err , stats ) {
65
- if ( err ) throw err ;
66
- deferred . resolve ( ) ;
67
- } )
68
- } ] ,
69
- "cheap sourcemap build" : [ [ 0 , 1 , 2 , 5 , 10 , 15 ] , function ( size , deferred ) {
70
- webpack ( {
71
- context : fixtures ,
72
- entry : "./" + size + ".big.js" ,
73
- output : {
74
- path : outputPath ,
75
- filename : "bundle.js"
76
- } ,
77
- devtool : "cheap-source-map"
78
- } , function ( err , stats ) {
79
- if ( err ) throw err ;
80
- deferred . resolve ( ) ;
81
- } )
82
- } ] ,
83
- "build w/ chunks" : [ [ 0 , 1 , 5 , 10 , 50 , 100 , 200 ] , function ( size , deferred ) {
84
- webpack ( {
85
- context : fixtures ,
86
- entry : "./" + size + ".async.js" ,
87
- output : {
88
- path : outputPath ,
89
- filename : "bundle.js"
90
- }
91
- } , function ( err , stats ) {
92
- if ( err ) throw err ;
93
- deferred . resolve ( ) ;
94
- } )
95
- } ] ,
96
- "build w/ chunks" : [ [ 0 , 1 , 5 , 10 , 50 , 100 , 200 ] , function ( size , deferred ) {
97
- webpack ( {
98
- context : fixtures ,
99
- entry : "./" + size + ".async.js" ,
100
- output : {
101
- path : outputPath ,
102
- filename : "bundle.js"
103
- }
104
- } , function ( err , stats ) {
105
- if ( err ) throw err ;
106
- deferred . resolve ( ) ;
107
- } )
108
- } ] ,
109
- "incremental" : [ [ 0 , 1 , 5 , 10 , 50 , 100 , 200 ] , function ( size , deferred ) {
110
- var compiler = webpack ( {
111
- cache : true ,
112
- context : fixtures ,
113
- entry : "./" + size + ".js" ,
114
- output : {
115
- path : outputPath ,
116
- filename : "bundle.js"
117
- }
118
- } ) ;
119
- runTimes ( compiler , 2 , deferred ) ;
120
- } ] ,
121
- "incremental cheap sourcemap" : [ [ 1 , 2 , 3 , 4 , 5 , 6 ] , function ( size , deferred ) {
122
- var compiler = webpack ( {
123
- cache : true ,
124
- context : fixtures ,
125
- entry : "./200.js" ,
126
- output : {
127
- path : outputPath ,
128
- filename : "bundle.js"
129
- } ,
130
- devtool : "cheap-source-map"
131
- } ) ;
132
- runTimes ( compiler , size , deferred ) ;
133
- } ] ,
134
- "incremental2" : [ [ 0 , 1 , 5 , 10 , 50 , 100 , 200 ] , function ( size , deferred ) {
135
- var compiler = webpack ( {
136
- cache : true ,
137
- context : fixtures ,
138
- entry : "./" + size + ".js" ,
139
- output : {
140
- path : outputPath ,
141
- filename : "bundle.js"
142
- }
143
- } ) ;
144
- runTimes ( compiler , 3 , deferred ) ;
145
- } ] ,
146
- "incremental4" : [ [ 0 , 1 , 5 , 10 , 50 , 100 , 200 ] , function ( size , deferred ) {
147
- var compiler = webpack ( {
148
- cache : true ,
149
- context : fixtures ,
150
- entry : "./" + size + ".js" ,
151
- output : {
152
- path : outputPath ,
153
- filename : "bundle.js"
154
- }
155
- } ) ;
156
- runTimes ( compiler , 5 , deferred ) ;
157
- } ] ,
158
- "incremental16" : [ [ 0 , 1 , 5 , 10 , 50 , 100 , 200 ] , function ( size , deferred ) {
159
- var compiler = webpack ( {
160
- cache : true ,
161
- context : fixtures ,
162
- entry : "./" + size + ".js" ,
163
- output : {
164
- path : outputPath ,
165
- filename : "bundle.js"
166
- }
167
- } ) ;
168
- runTimes ( compiler , 17 , deferred ) ;
169
- } ] ,
28
+ "normal build" : [
29
+ [ 0 , 1 , 5 , 10 , 50 , 100 , 200 ] ,
30
+ function ( size , deferred ) {
31
+ webpack ( {
32
+ context : fixtures ,
33
+ entry : "./" + size + ".js" ,
34
+ output : {
35
+ path : outputPath ,
36
+ filename : "bundle.js"
37
+ }
38
+ } , function ( err , stats ) {
39
+ if ( err ) throw err ;
40
+ deferred . resolve ( ) ;
41
+ } ) ;
42
+ }
43
+ ] ,
44
+ "eval dev build" : [
45
+ [ 0 , 1 , 2 , 5 , 10 , 15 ] ,
46
+ function ( size , deferred ) {
47
+ webpack ( {
48
+ context : fixtures ,
49
+ entry : "./" + size + ".big.js" ,
50
+ output : {
51
+ path : outputPath ,
52
+ filename : "bundle.js"
53
+ } ,
54
+ devtool : "eval"
55
+ } , function ( err , stats ) {
56
+ if ( err ) throw err ;
57
+ deferred . resolve ( ) ;
58
+ } )
59
+ }
60
+ ] ,
61
+ "sourcemap build" : [
62
+ [ 0 , 1 , 2 , 5 , 10 , 15 ] ,
63
+ function ( size , deferred ) {
64
+ webpack ( {
65
+ context : fixtures ,
66
+ entry : "./" + size + ".big.js" ,
67
+ output : {
68
+ path : outputPath ,
69
+ filename : "bundle.js"
70
+ } ,
71
+ devtool : "source-map"
72
+ } , function ( err , stats ) {
73
+ if ( err ) throw err ;
74
+ deferred . resolve ( ) ;
75
+ } )
76
+ }
77
+ ] ,
78
+ "cheap sourcemap build" : [
79
+ [ 0 , 1 , 2 , 5 , 10 , 15 ] ,
80
+ function ( size , deferred ) {
81
+ webpack ( {
82
+ context : fixtures ,
83
+ entry : "./" + size + ".big.js" ,
84
+ output : {
85
+ path : outputPath ,
86
+ filename : "bundle.js"
87
+ } ,
88
+ devtool : "cheap-source-map"
89
+ } , function ( err , stats ) {
90
+ if ( err ) throw err ;
91
+ deferred . resolve ( ) ;
92
+ } )
93
+ }
94
+ ] ,
95
+ "build w/ chunks" : [
96
+ [ 0 , 1 , 5 , 10 , 50 , 100 , 200 ] ,
97
+ function ( size , deferred ) {
98
+ webpack ( {
99
+ context : fixtures ,
100
+ entry : "./" + size + ".async.js" ,
101
+ output : {
102
+ path : outputPath ,
103
+ filename : "bundle.js"
104
+ }
105
+ } , function ( err , stats ) {
106
+ if ( err ) throw err ;
107
+ deferred . resolve ( ) ;
108
+ } )
109
+ }
110
+ ] ,
111
+ "build w/ chunks" : [
112
+ [ 0 , 1 , 5 , 10 , 50 , 100 , 200 ] ,
113
+ function ( size , deferred ) {
114
+ webpack ( {
115
+ context : fixtures ,
116
+ entry : "./" + size + ".async.js" ,
117
+ output : {
118
+ path : outputPath ,
119
+ filename : "bundle.js"
120
+ }
121
+ } , function ( err , stats ) {
122
+ if ( err ) throw err ;
123
+ deferred . resolve ( ) ;
124
+ } )
125
+ }
126
+ ] ,
127
+ "incremental" : [
128
+ [ 0 , 1 , 5 , 10 , 50 , 100 , 200 ] ,
129
+ function ( size , deferred ) {
130
+ var compiler = webpack ( {
131
+ cache : true ,
132
+ context : fixtures ,
133
+ entry : "./" + size + ".js" ,
134
+ output : {
135
+ path : outputPath ,
136
+ filename : "bundle.js"
137
+ }
138
+ } ) ;
139
+ runTimes ( compiler , 2 , deferred ) ;
140
+ }
141
+ ] ,
142
+ "incremental cheap sourcemap" : [
143
+ [ 1 , 2 , 3 , 4 , 5 , 6 ] ,
144
+ function ( size , deferred ) {
145
+ var compiler = webpack ( {
146
+ cache : true ,
147
+ context : fixtures ,
148
+ entry : "./200.js" ,
149
+ output : {
150
+ path : outputPath ,
151
+ filename : "bundle.js"
152
+ } ,
153
+ devtool : "cheap-source-map"
154
+ } ) ;
155
+ runTimes ( compiler , size , deferred ) ;
156
+ }
157
+ ] ,
158
+ "incremental2" : [
159
+ [ 0 , 1 , 5 , 10 , 50 , 100 , 200 ] ,
160
+ function ( size , deferred ) {
161
+ var compiler = webpack ( {
162
+ cache : true ,
163
+ context : fixtures ,
164
+ entry : "./" + size + ".js" ,
165
+ output : {
166
+ path : outputPath ,
167
+ filename : "bundle.js"
168
+ }
169
+ } ) ;
170
+ runTimes ( compiler , 3 , deferred ) ;
171
+ }
172
+ ] ,
173
+ "incremental4" : [
174
+ [ 0 , 1 , 5 , 10 , 50 , 100 , 200 ] ,
175
+ function ( size , deferred ) {
176
+ var compiler = webpack ( {
177
+ cache : true ,
178
+ context : fixtures ,
179
+ entry : "./" + size + ".js" ,
180
+ output : {
181
+ path : outputPath ,
182
+ filename : "bundle.js"
183
+ }
184
+ } ) ;
185
+ runTimes ( compiler , 5 , deferred ) ;
186
+ }
187
+ ] ,
188
+ "incremental16" : [
189
+ [ 0 , 1 , 5 , 10 , 50 , 100 , 200 ] ,
190
+ function ( size , deferred ) {
191
+ var compiler = webpack ( {
192
+ cache : true ,
193
+ context : fixtures ,
194
+ entry : "./" + size + ".js" ,
195
+ output : {
196
+ path : outputPath ,
197
+ filename : "bundle.js"
198
+ }
199
+ } ) ;
200
+ runTimes ( compiler , 17 , deferred ) ;
201
+ }
202
+ ] ,
170
203
} ;
171
204
172
205
var suite = new Benchmark . Suite ;
@@ -190,4 +223,6 @@ suite.on("cycle", function(event) {
190
223
console . log ( b . name + "\t" + Math . floor ( 1000 * ( b . stats . mean - b . stats . moe ) ) + "\t" + Math . floor ( 1000 * ( b . stats . mean + b . stats . moe ) ) ) ;
191
224
} ) ;
192
225
193
- suite . run ( { async : true } ) ;
226
+ suite . run ( {
227
+ async : true
228
+ } ) ;
0 commit comments