mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-01-09 06:21:59 -05:00
build playground/benchmark.js
This commit is contained in:
parent
d5c2991a25
commit
d8ae96a58c
3 changed files with 7 additions and 27 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
const ScratchStorage = require('scratch-storage');
|
||||||
|
const VirtualMachine = require('..');
|
||||||
|
|
||||||
const Scratch = window.Scratch = window.Scratch || {};
|
const Scratch = window.Scratch = window.Scratch || {};
|
||||||
|
|
||||||
const ASSET_SERVER = 'https://cdn.assets.scratch.mit.edu/';
|
const ASSET_SERVER = 'https://cdn.assets.scratch.mit.edu/';
|
||||||
|
@ -439,12 +442,12 @@ class ProfilerRun {
|
||||||
const runBenchmark = function () {
|
const runBenchmark = function () {
|
||||||
// Lots of global variables to make debugging easier
|
// Lots of global variables to make debugging easier
|
||||||
// Instantiate the VM.
|
// Instantiate the VM.
|
||||||
const vm = new window.VirtualMachine();
|
const vm = new VirtualMachine();
|
||||||
Scratch.vm = vm;
|
Scratch.vm = vm;
|
||||||
|
|
||||||
vm.setTurboMode(true);
|
vm.setTurboMode(true);
|
||||||
|
|
||||||
const storage = new ScratchStorage(); /* global ScratchStorage */
|
const storage = new ScratchStorage();
|
||||||
const AssetType = storage.AssetType;
|
const AssetType = storage.AssetType;
|
||||||
storage.addWebSource([AssetType.Project], getProjectUrl);
|
storage.addWebSource([AssetType.Project], getProjectUrl);
|
||||||
storage.addWebSource([AssetType.ImageVector, AssetType.ImageBitmap, AssetType.Sound], getAssetUrl);
|
storage.addWebSource([AssetType.ImageVector, AssetType.ImageBitmap, AssetType.Sound], getAssetUrl);
|
||||||
|
@ -481,7 +484,6 @@ const runBenchmark = function () {
|
||||||
vm.attachRenderer(renderer);
|
vm.attachRenderer(renderer);
|
||||||
const audioEngine = new window.AudioEngine();
|
const audioEngine = new window.AudioEngine();
|
||||||
vm.attachAudioEngine(audioEngine);
|
vm.attachAudioEngine(audioEngine);
|
||||||
/* global ScratchSVGRenderer */
|
|
||||||
vm.attachV2SVGAdapter(new ScratchSVGRenderer.SVGRenderer());
|
vm.attachV2SVGAdapter(new ScratchSVGRenderer.SVGRenderer());
|
||||||
vm.attachV2BitmapAdapter(new ScratchSVGRenderer.BitmapAdapter());
|
vm.attachV2BitmapAdapter(new ScratchSVGRenderer.BitmapAdapter());
|
||||||
|
|
||||||
|
@ -555,7 +557,7 @@ const runBenchmark = function () {
|
||||||
* @param {object} json data from a previous benchmark run.
|
* @param {object} json data from a previous benchmark run.
|
||||||
*/
|
*/
|
||||||
const renderBenchmarkData = function (json) {
|
const renderBenchmarkData = function (json) {
|
||||||
const vm = new window.VirtualMachine();
|
const vm = new VirtualMachine();
|
||||||
new ProfilerRun({vm}).render(json);
|
new ProfilerRun({vm}).render(json);
|
||||||
setShareLink(json);
|
setShareLink(json);
|
||||||
};
|
};
|
||||||
|
|
|
@ -79,16 +79,6 @@
|
||||||
|
|
||||||
<div id="blocks"></div>
|
<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 -->
|
<!-- Playground -->
|
||||||
<script src="./benchmark.js"></script>
|
<script src="./benchmark.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -88,19 +88,7 @@ module.exports = [
|
||||||
defaultsDeep({}, base, {
|
defaultsDeep({}, base, {
|
||||||
target: 'web',
|
target: 'web',
|
||||||
entry: {
|
entry: {
|
||||||
'scratch-vm': './src/index.js',
|
'benchmark': './src/playground/benchmark',
|
||||||
'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'
|
|
||||||
],
|
|
||||||
'video-sensing-extension-debug': './src/extensions/scratch3_video_sensing/debug'
|
'video-sensing-extension-debug': './src/extensions/scratch3_video_sensing/debug'
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
|
|
Loading…
Reference in a new issue