Skip to main content

Posts

Showing posts with the label Optimization

Corona SDK newRect() vs newImageRect() performance comparison

My next Corona game contains quite a lot of explosion effects in pixel art style, where I basically just scatter a number of single-colored squares in different directions. The squares are all created using display.newRect()  which I figured had to be both the easiest and most efficent way for creating these simple geometrical shapes. Explosion close-up from Ice Trap But then it kind of hit me: What if using newImageRect() with a 1px image scaled to the desired size could actually be faster than newRect() ? Not very likely, but since I have no idea how the Corona SDK graphics engine is implemented I had to try it out with a little sample program. I decided to run three separate tests. Not scientific in any way, but at least it should give me a clue of which function performs best. In each of the tests I just created a bunch of squares of the same size randomized across the screen, and measured the time taken to create them. The three tests had the following setup: 1. Use...