Profilage
Description
Profiling the code of FreeCAD helps find bottlenecks in the algorithms used to create or manipulate objects.
To profile Python code use the standard cProfile
module to define start and end points to profile in the code.
import cProfile
pr = cProfile.Profile()
pr.enable()
# --------------------------------------
# Lines of code that you want to profile
# --------------------------------------
pr.disable()
pr.dump_stats("/tmp/profile.cprof")
Then install and use pyprof2calltree
to convert the profile output into cachegrind input.
pyprof2calltree -i /tmp/profile.cprof -o /tmp/callgrind.out
Then visualize this information with kcachegrind
for Linux or qcachegrind
for Windows.
kcachegrind /tmp/callgrind.out
Resources
- The Python profilers,
cProfile
andpython
. - pyprof2calltree at PyPI; pyprof2calltree repository.
- FreeCAD's Python profiling tutorial.
Hub utilisateurs expérimentés
- Scripts FreeCAD : Python, Introduction à Python, Tutoriel sur les scripts Python, Débuter avec les scripts
- Modules : Modules intégrés, Unités, Quantity
- Ateliers : Création d'atelier, Commands Gui, Les commandes, Installer des ateliers supplémentaires
- Maillages et objets Parts : Scripts Mesh, Script de données topologiques, Conversion objet Mesh en Part, PythonOCC
- Objets paramétriques : Objets créés par script, Viewproviders (Icône personnalisée dans l'arborescence)
- Scénographie : Graphe de scène Coin (Inventor), Pivy
- Interface graphique : Création d'interface, Création d'une boite de dialogue (1, 2, 3, 4, 5), PySide, Exemples PySide débutant, intermédiaire, expérimenté
- Macros : Macros, Comment installer des macros
- Intégration : Intégrer FreeCAD, Intégration de FreeCADGui
- Autre : Expressions, Extraits de codes, Fonction - tracer une ligne, Bibliothèque mathématique vectorielle de FreeCAD (déprécié)