build playground/benchmark.js

This commit is contained in:
Michael "Z" Goddard 2019-01-22 17:42:34 -05:00
parent d5c2991a25
commit d8ae96a58c
No known key found for this signature in database
GPG key ID: 762CD40DD5349872
3 changed files with 7 additions and 27 deletions

View file

@ -1,3 +1,6 @@
const ScratchStorage = require('scratch-storage');
const VirtualMachine = require('..');
const Scratch = window.Scratch = window.Scratch || {};
const ASSET_SERVER = 'https://cdn.assets.scratch.mit.edu/';
@ -439,12 +442,12 @@ class ProfilerRun {
const runBenchmark = function () {
// Lots of global variables to make debugging easier
// Instantiate the VM.
const vm = new window.VirtualMachine();
const vm = new VirtualMachine();
Scratch.vm = vm;
vm.setTurboMode(true);
const storage = new ScratchStorage(); /* global ScratchStorage */
const storage = new ScratchStorage();
const AssetType = storage.AssetType;
storage.addWebSource([AssetType.Project], getProjectUrl);
storage.addWebSource([AssetType.ImageVector, AssetType.ImageBitmap, AssetType.Sound], getAssetUrl);
@ -481,7 +484,6 @@ const runBenchmark = function () {
vm.attachRenderer(renderer);
const audioEngine = new window.AudioEngine();
vm.attachAudioEngine(audioEngine);
/* global ScratchSVGRenderer */
vm.attachV2SVGAdapter(new ScratchSVGRenderer.SVGRenderer());
vm.attachV2BitmapAdapter(new ScratchSVGRenderer.BitmapAdapter());
@ -555,7 +557,7 @@ const runBenchmark = function () {
* @param {object} json data from a previous benchmark run.
*/
const renderBenchmarkData = function (json) {
const vm = new window.VirtualMachine();
const vm = new VirtualMachine();
new ProfilerRun({vm}).render(json);
setShareLink(json);
};

View file

@ -79,16 +79,6 @@
<div id="blocks"></div>
<!-- FPS counter, Blocks, Renderer -->
<script src="./vendor.js"></script>
<!-- Storage module -->
<script src="./scratch-storage.js"></script>
<!-- Stage rendering -->
<script src="./scratch-render.js"></script>
<!-- SVG rendering -->
<script src="./scratch-svg-renderer.js"></script>
<!-- VM -->
<script src="./scratch-vm.js"></script>
<!-- Playground -->
<script src="./benchmark.js"></script>
</body>

View file

@ -88,19 +88,7 @@ module.exports = [
defaultsDeep({}, base, {
target: 'web',
entry: {
'scratch-vm': './src/index.js',
'vendor': [
// FPS counter
'stats.js/build/stats.min.js',
// Scratch Blocks
'scratch-blocks/dist/vertical.js',
// Audio
'scratch-audio',
// Storage
'scratch-storage',
// Renderer
'scratch-render'
],
'benchmark': './src/playground/benchmark',
'video-sensing-extension-debug': './src/extensions/scratch3_video_sensing/debug'
},
output: {