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:
@@ -6,6 +6,8 @@ const config = require('../../config')
|
||||
|
||||
const SAVE_DEBOUNCE_INTERVAL = 1000
|
||||
|
||||
appConfig.filePath = path.join(config.CONFIG_PATH, 'config.json')
|
||||
|
||||
const State = module.exports = Object.assign(new EventEmitter(), {
|
||||
getDefaultPlayState,
|
||||
load,
|
||||
@@ -16,13 +18,11 @@ const State = module.exports = Object.assign(new EventEmitter(), {
|
||||
// After first State.save() invokation, future calls go straight to the
|
||||
// debounced function
|
||||
State.save = debounce(saveImmediate, SAVE_DEBOUNCE_INTERVAL)
|
||||
State.save()
|
||||
State.save(...arguments)
|
||||
},
|
||||
saveImmediate
|
||||
})
|
||||
|
||||
appConfig.filePath = path.join(config.CONFIG_PATH, 'config.json')
|
||||
|
||||
function getDefaultState () {
|
||||
const LocationHistory = require('location-history')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user