Profilieren und Verbesserung der Leistung
Verfassen Sie einfachen und lesbaren Code, insbesondere für die erste Implementierung. Code, der zu früh optimiert wird, kann unnötig komplex werden, ohne dass es zu einer signifikanten Leistungsverbesserung kommt. Wenn die Geschwindigkeit zu einem Problem werden sollte, können Sie messen, wie lang die Code-Ausführung dauert, und dann das Codeprofil prüfen, um Engpässe zu ermitteln. Im Bedarfsfall können Sie Schritte zur Leistungssteigerung ergreifen.
Apps
| Profiler | Run code and measure execution time to improve performance |
Funktionen
Themen
- Messen der Leistung Ihres Codes
Verwenden Sie die Funktion
timeitoder die Stoppuhr-Funktionenticundtoc, um zu messen, wie lange die Ausführung Ihres Codes dauert. - Profile Your Code to Improve Performance
Use the Profiler to measure the time it takes to run your code and identify which lines of code consume the most time or which lines do not run.
- Measure Code Complexity Using Cyclomatic Complexity
Quantify code complexity based on cyclomatic complexity.
- Techniques to Improve Performance
To speed up the performance of your code, there are several techniques that you can consider.