Skip to content

Commit

Permalink
Build and shim improvements (#1446)
Browse files Browse the repository at this point in the history
* Use parallel mode for Terser
* Improve hrtime shim code
  • Loading branch information
MaxGraey committed Sep 4, 2020
1 parent ed7570f commit 1355ae7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cli/shim/process.js
Expand Up @@ -45,12 +45,12 @@ var performanceNow =
function(){ return (new Date()).getTime(); };

function hrtime(previousTimestamp) {
var clocktime = performanceNow.call(performance) * 1e-3;
var seconds = Math.floor(clocktime);
var nanoseconds = Math.floor((clocktime % 1) * 1e9);
var clocktime = performanceNow.call(performance);
var seconds = Math.floor(clocktime * 1e-3);
var nanoseconds = Math.floor(clocktime * 1e6 - seconds * 1e9);
if (previousTimestamp) {
seconds = seconds - previousTimestamp[0];
nanoseconds = nanoseconds - previousTimestamp[1];
seconds -= previousTimestamp[0];
nanoseconds -= previousTimestamp[1];
if (nanoseconds < 0) {
seconds--;
nanoseconds += 1e9;
Expand Down
2 changes: 2 additions & 0 deletions webpack.config.js
Expand Up @@ -53,6 +53,7 @@ const lib = {
preamble: preamble("The AssemblyScript Compiler.")
}
},
parallel: true,
sourceMap: true
})
],
Expand Down Expand Up @@ -120,6 +121,7 @@ const bin = {
preamble: preamble("The AssemblyScript Compiler Frontend.")
}
},
parallel: true,
sourceMap: true
})
],
Expand Down

0 comments on commit 1355ae7

Please sign in to comment.