Refactor 2022 #38

567.jpg

Object-first is an easy choice with many small squares. There are many squares, each affecting just a few pixels. A pixel-first approach would result in many empty tests. Each pixel is tested against each square. Almost all of those tests are false, resulting in a do-nothing step.

Of course the key is that for the object, in this case a square, there is an efficient way to say in bulk which pixels are covered by the square. All those do-nothing, not-in-the-square tests are avoided.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.