4aa167e523062eaeb5d1b4d29969735412eb4e65
isWhiteSpace works by trimming the entire string. This works, but in the
context we use it, this is a lot of unnecessary work.
At this point we know that `+x === 0` and we want to know if that's
because x is empty or because it actually contains 0, hence we can use
a loop that just checks for a 0 existing in the string. This relies on
the assumption that there is no x such that:
+x === 0 && x.trim().length !== 0 && !x.includes('0')
In a very biased microbenchmark (https://scratch.mit.edu/projects/788352711)
this results in a 10% performance improvement.
This also will allow us to resolve https://github.com/TurboWarp/scratch-vm/issues/115
in a later commit.
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.
Description
Scratch VM with a JIT compiler and more features
https://turbowarp.org/
35 MiB
0 Stars
2 Watchers
0 Forks
Languages
JavaScript
99.7%
HTML
0.2%