Poor performance when porting TIC-80 code to Pyxel
Hello,

As a learning exercise, I've decided to port a TIC-80 game to Pyxel.

I've chosen the game [“star travel” by visy](https://tic80.com/play?cart=3154), and I came up with this code:

```python
import math
import pyxel
import random


class App:
    def __init__(self):
        # Initialize variables
        self.t = 0
        self.x = 96
        self.y = 24
        self.stars = []
        self.starcount = 1024
        self.camera = {"x": 0, "y": 0}
        self.min_z = 15
        self.max_z = 50
        self.delta_time = 0
        self.previous_time = 0

        # Create stars
        for i in range(self.starcount):
            self.stars.append({
                "size": 2,
                "x": random.random() * 320,
                "y": random.random() * 128,
                "z": 32 * random.random() * (self.max_z - self.min_z) + self.min_z,
                "x_rotation": 0,
                "y_rotation": 0
            })

        # Initialize Pyxel
        pyxel.init(240, 136, title="Particle test", fps=60)
        pyxel.run(self.update, self.draw)

    # Get current time
    def time(self):
        # Number of frames times the duration of a frame in milliseconds
        return pyxel.frame_count * 1/60

    # Update function
    def update(self):
        # Calculate time delta
        self.delta_time = self.time() - self.previous_time
        self.previous_time = self.time()

        # Quit if Q is pressed
        if pyxel.btnp(pyxel.KEY_Q):
            pyxel.quit()

    # Draw stars
    def draw_stars(self):
        camera_x_offset = -128
        camera_y_offset = -64
        camera_zoom = 5 + math.cos(self.time() * 0.0001) * 8

        # Draw each star
        for i in range(self.starcount):
            # Calculate star angle
            angle = math.cos(self.time() * 0.0001 + math.sin(self.time() * 0.0001) + self.stars[i]["z"] * 0.004) * math.pi
            sin = math.sin(angle) * camera_zoom
            cos = math.cos(angle) * camera_zoom

            # Calculate star position and size
            self.stars[i]["x_rotation"] = ((camera_x_offset + self.stars[i]["x"]) * cos - (camera_y_offset + self.stars[i]["y"]) * sin) - camera_x_offset
            self.stars[i]["y_rotation"] = ((camera_y_offset + self.stars[i]["y"]) * cos + (camera_x_offset + self.stars[i]["x"]) * sin) - camera_y_offset
            self.stars[i]["z"] = (self.stars[i]["z"] - self.delta_time * 0.1) % 256
            proj_z = self.stars[i]["z"] / self.max_z
            star_position = {"x": (128 - self.stars[i]["x_rotation"]) / proj_z, "y": (64 - self.stars[i]["y_rotation"]) / proj_z}
            star_size = self.stars[i]["size"] / proj_z

            # Draw star
            pyxel.elli(128 + star_position["x"] - star_size / 2, 64 + star_position["y"] - star_size / 2, star_size, star_size, math.floor(16 - self.stars[i]["z"] / 32))

    # Draw function
    def draw(self):
        pyxel.cls(0)
        self.draw_stars()


# Start the app
App()
```

While the code works, it quickly hangs and uses maximum CPU.