Framework for micro-performance tests

I have been curious about tiny optimizations that could apply when you can choose between two semantically or functionally identical blocks. Consider the following:

That last one is quite dramatic!

I have made a project framework to test these duos (click any of the images).
My hope is that the community will find it useful and start posting their own tests so that we might build a nice library of performance tests.

To create a new test, in the A and B sprites, you would modify what happens here:

And you would change the labels in the global variable LABELS:

The project could, of course, be extended to do do more than 2 variables. I won't be able to build a library on my own, but I will contribute at a few more I think. I want to next
test:

  • bitmap vs vector
  • ghost vs native alpha channel

which OF? there are so many!


(edit: after seeing the code, I now understand you meant the fourth one. but still.)

Great opportunity to extend code to handle more than 2 variables. Although, can you use ask [ V] for (() @addInput) :: control in place of all of them?

ask [ V] for (() @addInput) @:>
no, unfortunately. only the [ V] of [ V] can be substituted using ask.

These two tests belong together. It would seem that inlining a (sprite-local) custom block does not speed things up ... UNLESS it's under an event hat that is being broadcasted to frequently.

However, this not a safe conclusion because it's not clear that the two options produce identical visual output. The animation produced in Broadcast Short is noticeably choppy. The shorter execution time may be because Snap! is actually dropping frames. Or, it is rendering them faster than humans can perceive -- in which case it is a valid result.