Why is it that compiling a costume from a list can be so slow? Is there a way to make this process quicker? Is there some kind of process that makes this slow in the first place?
Oh, wow. That's an impressive penalty for typing numbers into a list reporter. I'm fixing this right now, it should be exactly the same short duration for any of these representations. The good news, is, this can be done. Will be in the next minor release coming up before Christmas.
The performance degradation was obvious for the specific scenario, where the same costume data was slightly modified and reused.
But there are no "low hanging fruits" for a generic case.
The performance penalty is caused by the implicit conversion of a string to a number by JS engine. So if you take into account both manipulating pixel list and setting costume there will be no substantial difference. Actually, the list of char version is 2 x faster because calling a custom reporter causes extra delay.
Filling the entire costume with color is faster this way, with a precalculated pixel list. But it still 500 ms for 500x600 costume (or ~100ms for 240x360).
So maybe some APL construct based on reshaping can help with this.
Or building an array exponentially by
Luckily it turns out there is a low hanging fruit that solves all of these issues by explicitly converting data to numbers at the primitive level. This simple change - already tested - makes all variants equally fast. To be released later today.
No, rather to limit iterations.
This way list with 2^20 elements is created in 20 steps instead of 2^20 with a map primitive.
It's just a sidenote. I've read much about the expressive power of APL for array processing. So maybe effective filling an array with a const value is possible.
Turns out I didn't need to. Simply explicitly making sure to convert whatever is stored inside a pixels-list to number using +value when sticking it into imageData has an astounding effect.
I didn't get the block from that project. I just saw uses of it in certain script pics, but I couldn't find the definition. I just make a new definition of it everytime I want to use it.