Comparing version 0.7.0-beta2 to 0.7.0-beta3
@@ -8,3 +8,3 @@ /* | ||
var TIMES = 2; | ||
var TIMES = 5; | ||
@@ -11,0 +11,0 @@ /* TESTS */ |
@@ -107,9 +107,17 @@ /* | ||
profile.end = new Date(); | ||
profile.module.profile = { | ||
time: profile.end - profile.start, | ||
timeResolve: profile.resolveEnd - profile.start, | ||
timeResolvePrePostLoaders: profile.resolvePrePostLoadersEnd - profile.resolveEnd, | ||
timeLoadersCheck: profile.loadersCheckEnd - profile.resolvePrePostLoadersEnd, | ||
timeBuildModule: profile.buildModuleEnd - profile.loadersCheckEnd, | ||
timeChildren: profile.end - profile.buildModuleEnd | ||
if(profile.buildModule) { | ||
profile.module.profile = { | ||
time: profile.end - profile.start, | ||
timeResolve: profile.resolveEnd - profile.start, | ||
timeResolvePrePostLoaders: profile.resolvePrePostLoadersEnd - profile.resolveEnd, | ||
timeLoadersCheck: profile.loadersCheckEnd - profile.resolvePrePostLoadersEnd, | ||
timeBuildWaiting: (profile.buildModuleEnd - profile.loadersCheckEnd) - (profile.buildModule.end - profile.buildModule.start), | ||
timeBuildModule: profile.buildModule.end - profile.buildModule.start, | ||
timeBuildModuleRead: profile.buildModule.readEnd - profile.buildModule.start, | ||
timeBuildModulePreLoaders: profile.buildModule.preLoadersEnd - profile.buildModule.readEnd, | ||
timeBuildModuleLoaders: profile.buildModule.loadersEnd - profile.buildModule.preLoadersEnd, | ||
timeBuildModulePostLoaders: profile.buildModule.postLoadersEnd - profile.buildModule.loadersEnd, | ||
timeBuildModuleParse: profile.buildModule.end - profile.buildModule.postLoadersEnd, | ||
timeChildren: profile.end - profile.buildModuleEnd | ||
} | ||
} | ||
@@ -116,0 +124,0 @@ } |
@@ -15,2 +15,6 @@ var fs = require("fs"); | ||
if(options.profile) var profile = { | ||
start: new Date().getTime() | ||
} | ||
var dependencyInfo = { | ||
@@ -32,2 +36,4 @@ cacheable: true, | ||
profile && (profile.readEnd = new Date().getTime()); | ||
var loaderContext = { | ||
@@ -44,2 +50,3 @@ loaders: loaders, | ||
if(err) return callback(err); | ||
profile && (profile.preLoadersEnd = new Date().getTime()); | ||
loaderContext.loaderType = "loader"; | ||
@@ -49,2 +56,3 @@ execLoaders(context, filenameWithLoaders, loaders, [filename], result, loaderContext, dependencyInfo, options, | ||
if(err) return callback(err); | ||
profile && (profile.loadersEnd = new Date().getTime()); | ||
loaderContext.loaderType = "postLoader"; | ||
@@ -54,2 +62,3 @@ execLoaders(context, filenameWithLoaders, postLoaders, [filename], result, loaderContext, dependencyInfo, options, | ||
if(err) return callback(err); | ||
profile && (profile.postLoadersEnd = new Date().getTime()); | ||
return processJs(result) | ||
@@ -71,8 +80,9 @@ }); | ||
} catch(e) { | ||
callback("File \"" + filenameWithLoaders + "\" parsing failed: " + e); | ||
callback(new Error("File \"" + filenameWithLoaders + "\" parsing failed: " + e)); | ||
return; | ||
} | ||
return callback(null, source, deps, dependencyInfo); | ||
profile && (profile.end = new Date().getTime()); | ||
return callback(null, source, deps, dependencyInfo, profile); | ||
} | ||
} | ||
module.exports = buildModule; |
@@ -14,3 +14,2 @@ var buildModule = require("./buildModule"); | ||
} | ||
process.send(null); | ||
}); |
@@ -74,8 +74,3 @@ /* | ||
else if(valueTime > middleTime) moduleLine += c("\033[1m\033[33m"); | ||
var buildProfile = module.profile.buildModule; | ||
if(buildProfile) buildProfile = " (" + | ||
(buildProfile.loaders && buildProfile.loaders.length > 0 ? "loaders: " + buildProfile.loaders.join("ms, ") + "ms" : "") + | ||
")"; | ||
else buildProfile = ""; | ||
moduleLine += " [" + module.profile.time + "ms: " + (module.profile.timeResolve + module.profile.timeResolvePrePostLoaders) + "ms resolving, " + module.profile.timeBuildModule + "ms build" + buildProfile + ", " + module.profile.timeChildren + "ms children]"; | ||
moduleLine += " [" + module.profile.time + "ms: " + (module.profile.timeResolve + module.profile.timeResolvePrePostLoaders) + "ms resolving, " + module.profile.timeBuildWaiting + "ms waiting" + ", " + module.profile.timeBuildModule + "ms build" + ", " + module.profile.timeChildren + "ms children]"; | ||
if(valueTime > middleTime) moduleLine += c("\033[39m\033[22m"); | ||
@@ -82,0 +77,0 @@ } |
@@ -466,3 +466,3 @@ /* | ||
fileModulesMap[path.basename(chunk.filename)] = modulesArray; | ||
chunkNameMap[chunkId] = path.basename(chunk.filename); | ||
chunkNameMap[chunkId] = path.basename(chunk.filename).replace(HASH_REGEXP, hash); | ||
}); | ||
@@ -469,0 +469,0 @@ buffer.modulesIncludingDuplicates = sum; |
@@ -5,5 +5,4 @@ var child_process = require("child_process"); | ||
this.nextId = 1; | ||
this.jobs = []; | ||
this.freeWorkers = []; | ||
this.workers = []; | ||
this.workersJobs = []; | ||
this.callbacks = {}; | ||
@@ -13,4 +12,4 @@ for(var i = 0; i < count; i++) { | ||
this.workers.push(worker); | ||
this.freeWorkers.push(worker); | ||
this.bindWorker(worker); | ||
this.workersJobs.push(0); | ||
this.bindWorker(worker, i); | ||
} | ||
@@ -21,23 +20,21 @@ } | ||
Workers.prototype.run = function(parameters, callback) { | ||
if(this.freeWorkers.length > 0) | ||
this.pushJob(this.freeWorkers.shift(), parameters, callback); | ||
else | ||
this.jobs.push([parameters, callback]); | ||
var worker = 0; | ||
var minJobs = -1; | ||
this.workersJobs.forEach(function(jobs, idx) { | ||
if(jobs < minJobs || minJobs == -1) { | ||
minJobs = jobs; | ||
worker = idx; | ||
} | ||
}); | ||
this.workersJobs[worker]++; | ||
this.pushJob(this.workers[worker], parameters, callback); | ||
} | ||
Workers.prototype.bindWorker = function(worker) { | ||
Workers.prototype.bindWorker = function(worker, idx) { | ||
worker.on("message", function(result) { | ||
if(Array.isArray(result)) { | ||
var id = result.shift(); | ||
var callback = this.callbacks[id]; | ||
delete this.callbacks[id]; | ||
callback.apply(null, result); | ||
} else { | ||
if(this.jobs.length > 0) { | ||
var job = this.jobs.shift(); | ||
this.pushJob(worker, job[0], job[1]); | ||
} else { | ||
this.freeWorkers.push(worker); | ||
} | ||
} | ||
this.workersJobs[idx]--; | ||
var id = result.shift(); | ||
var callback = this.callbacks[id]; | ||
delete this.callbacks[id]; | ||
callback.apply(null, result); | ||
}.bind(this)); | ||
@@ -44,0 +41,0 @@ } |
{ | ||
"name": "webpack", | ||
"version": "0.7.0-beta2", | ||
"version": "0.7.0-beta3", | ||
"author": "Tobias Koppers @sokra", | ||
@@ -5,0 +5,0 @@ "description": "Packs CommonJs/AMD Modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loading of js, json, jade, coffee, css, ... out of the box and more with custom loaders.", |
@@ -526,4 +526,3 @@ # webpack | ||
// the main process. | ||
// In watch mode, worker processes only start once. So workers = true | ||
// is recommended for watch mode. | ||
// Pushing jobs to worker processes has an addititional overhead of ~100ms. | ||
@@ -530,0 +529,0 @@ closeWorkers: false, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
366140
8971
963