mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -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
|
// Clear the current runtime
|
||||||
this.clear();
|
this.clear();
|
||||||
|
|
||||||
|
if (typeof performance !== 'undefined') {
|
||||||
|
performance.mark('scratch-vm-deserialize-start');
|
||||||
|
}
|
||||||
const runtime = this.runtime;
|
const runtime = this.runtime;
|
||||||
const deserializePromise = function () {
|
const deserializePromise = function () {
|
||||||
const projectVersion = projectJSON.projectVersion;
|
const projectVersion = projectJSON.projectVersion;
|
||||||
|
@ -492,8 +495,14 @@ class VirtualMachine extends EventEmitter {
|
||||||
return Promise.reject('Unable to verify Scratch Project version.');
|
return Promise.reject('Unable to verify Scratch Project version.');
|
||||||
};
|
};
|
||||||
return deserializePromise()
|
return deserializePromise()
|
||||||
.then(({targets, extensions}) =>
|
.then(({targets, extensions}) => {
|
||||||
this.installTargets(targets, extensions, true));
|
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