mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
use performance.mark to measure deserialize time
This commit is contained in:
parent
293e8917a8
commit
6dda5c4963
1 changed files with 11 additions and 2 deletions
|
@ -478,6 +478,9 @@ class VirtualMachine extends EventEmitter {
|
|||
// Clear the current runtime
|
||||
this.clear();
|
||||
|
||||
if (typeof performance !== 'undefined') {
|
||||
performance.mark('scratch-vm-deserialize-start');
|
||||
}
|
||||
const runtime = this.runtime;
|
||||
const deserializePromise = function () {
|
||||
const projectVersion = projectJSON.projectVersion;
|
||||
|
@ -492,8 +495,14 @@ class VirtualMachine extends EventEmitter {
|
|||
return Promise.reject('Unable to verify Scratch Project version.');
|
||||
};
|
||||
return deserializePromise()
|
||||
.then(({targets, extensions}) =>
|
||||
this.installTargets(targets, extensions, true));
|
||||
.then(({targets, extensions}) => {
|
||||
if (typeof performance !== 'undefined') {
|
||||
performance.mark('scratch-vm-deserialize-end');
|
||||
performance.measure('scratch-vm-deserialize',
|
||||
'scratch-vm-deserialize-start', 'scratch-vm-deserialize-end');
|
||||
}
|
||||
return this.installTargets(targets, extensions, true);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue