GarboMuffin 125f20b9ce Revert "Don't use createImageBitmap to load bitmap costumes"
Reverts 7abbcdbb10

I am unable to reproduce the claim that ImageBitmap uses more memory
than <img>. Instead I've observed the following:

<img> uses a base64 data: URI which is slower than creating a Blob
directly from the binary data. I also experimented using a blob: URI
with <img> and did find it to perform better. A future commit may use
this when createImageBitmap() is not available.

<img> can't be reliably decoded in parallel. Chrome in particular will
very often wait until texImage2d() to actually decode the image, which
turns image decoding into a single-threaded process. Calling decode()
does not affect this. createImageBitmap is reliably parallelized.

<img>'s only benefit is that projects with a lot of copies of the same
exact costume will usually have their image decoding happen only once
whereas createImageBitmap() will decode each one individually (does not
apply when using blob: URIs).

Chrome:
<img> with data:    48.5MB  4160ms
<img> with blob:    48.4MB  2162ms
createImageBitmap() 48.4MB  1261ms
Equivalent SVGs     60.8MB  3857ms

Firefox:
<img> with data:    88.3MB  3704ms
<img> with blob:    88.9MB  2459ms
createImageBitmap() 92.5MB  2380ms
Equivalent SVGs     483.3MB 5429ms

Using a test project with 100 480x360 unique costumes.
Equivalent SVGs is the same project with each costume converted to SVG,
just for curiosity. Note that SVGs may not actually be rendered or
decoded until the project starts.
2022-07-31 01:51:23 -05:00
2018-05-11 08:20:20 -04:00
2020-07-16 18:43:11 -05:00
2016-06-08 16:27:38 -04:00
2017-11-20 19:18:18 -05:00
2022-05-22 20:09:59 -05:00
2018-06-18 13:13:09 -04:00

TurboWarp/scratch-vm

Modified Scratch VM with a JIT compiler and more features.

This is a drop-in replacement for LLK/scratch-vm.

Setup

See https://github.com/TurboWarp/scratch-gui/wiki/Getting-Started to setup the complete TurboWarp environment.

If you just want to play with the VM then it's the same process as upstream scratch-vm.

Extension authors

If you only use the standard reporter, boolean, and command block types, everything should just work without any changes.

Compiler Overview

For a high-level overview of how the compiler works, see https://docs.turbowarp.org/how

For more technical information, read the code in src/compiler.

Public API

This section was too out of date to be useful. We hope to re-add it as some point.

S
Description
Scratch VM with a JIT compiler and more features
https://turbowarp.org/
Readme MPL-2.0
35 MiB
0 Stars 2 Watchers 0 Forks
Languages
JavaScript 99.7%
HTML 0.2%