mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 14:32:59 -05:00
Merge pull request #2903 from cwillisf/performance-mark-deserialize
use performance.mark to measure deserialize time
This commit is contained in:
commit
d119ca2477
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