Files
scratch-vm/test/unit
GarboMuffin 4aa167e523 Replace isWhiteSpace with something faster
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.
2023-01-14 22:06:26 -06:00
..
2018-03-31 13:41:39 -03:00
2022-05-28 19:04:44 -05:00
2022-05-28 19:04:50 -05:00
2019-01-25 10:31:33 +09:00
2021-01-31 14:28:17 -06:00
2018-01-26 17:13:01 -04:00
2022-05-28 19:05:27 -05:00
2022-12-07 10:41:07 -06:00
2019-03-26 11:56:50 -04:00
2019-02-04 19:05:44 -05:00