import sys, math, time # 1. Import the time module
from PyQt5.QtWidgets import QApplication, QWidget
from PyQt5.QtGui import QPainter, QColor
from PyQt5.QtCore import Qt

class ArtWidget(QWidget):
    def paintEvent(self, event):
        p = QPainter(self); p.setRenderHint(QPainter.Antialiasing); p.fillRect(self.rect(), Qt.black)
        p.translate(self.width() / 2, self.height() / 2)
        
        # --- BENCHMARK START ---
        start_time = time.perf_counter() # 2. Record start time

        for i in range(250):
            p.setPen(QColor.fromHsv(int(i * 2) % 360, 255, 255, 120))
            p.rotate(11.5); p.drawEllipse(int(self.width()/12), 0, int(self.width()/2.5), int(self.height()/8))
        
        # --- BENCHMARK END ---
        end_time = time.perf_counter() # 3. Record end time
        duration = end_time - start_time
        print(f"🎨 Drawing process took: {duration:.4f} seconds") # 4. Print the result

app = QApplication(sys.argv); w = ArtWidget(); w.resize(800, 800); w.show(); sys.exit(app.exec_())
