Macro Recompute Profiler/en

Description
This macro is to help you find, what features cause long delays in updates to the project. It performs a recompute, measuring the time it takes to recompute each feature.

How to use
This macro requires FreeCAD no less than 0.17.10644

Save the macro to a file.

1. Open your project

2. Right-click an object in model tree, pick "Mark to recompute"

3. Run this macro.

A progress bar will appear. As each object is recomputed, a line is printed to Report View, containing the time and the label of the object. If any object fails to recompute, the macro will display an error message and terminate the process.

Post-processing results
The output of the macro will be interleaved with general messages produced by recomputing features. It generally looks like this:

The result lines have an easy signature to separate them off: they start with a tab. So, if you copy-paste the whole chunk to a spreadsheet program, generic messages will end up in column 1, while the results are in columns 2 and 3. So, you can sort by column 2, to get a nice table like that:

(For MS-Excel, make sure you start selecting the report view log from the first line with timing data. Otherwise, it pastes everything into first column, stripping away all tabs.)

Macro
RecomputeProfiler.FCMacro

FC version
This macro requires FreeCAD no less than 0.17.10644, which was the version where App.ActiveDocument.RecomputesFrozen became available. It might be functional with a bit older FreeCAD, but certainly won't work with v0.16.

This macro was created using this version of FreeCAD: