perf: 90ms improvement: Defer more code in renderer, load state earlier

By deferring more code in the renderer and loading state earlier, we
improve startup time by another 90ms!

Before: 507 unique requires (1270-1280ms)
After: 506 unique requires  (1180-1190ms)
This commit is contained in:
Feross Aboukhadijeh
2016-09-30 22:00:58 -07:00
parent 02f5dbb63f
commit 5ff2d893b9
4 changed files with 49 additions and 28 deletions

View File

@@ -2,6 +2,7 @@
// Reports back so that we can improve WebTorrent Desktop
module.exports = {
init,
send,
logUncaughtError,
logPlayAttempt
}
@@ -22,7 +23,9 @@ function init (state) {
telemetry = state.saved.telemetry = createSummary()
reset()
}
}
function send (state) {
const now = new Date()
telemetry.version = config.APP_VERSION
telemetry.timestamp = now.toISOString()
@@ -223,7 +226,7 @@ function getElemString (elem) {
let ret = elem.tagName
try {
ret += '.' + Array.from(elem.classList).join('.')
} catch (e) {}
} catch (err) {}
return ret
}