Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement optional profiling for export #1977

Merged
merged 2 commits into from
Oct 31, 2020

Conversation

MoritzBrueckner
Copy link
Collaborator

@MoritzBrueckner MoritzBrueckner commented Oct 31, 2020

Linked to armory3d/armsdk#16.

Combined with the PR above, you can now choose to run cProfile when exporting the scene. This will generate a file called profile_exporter.prof in the SDK directory with detailed information about the number of calls and the time taken by the functions called during export. This file can then be opened by tools such as SnakeViz to get a graphical representation of whats happening during export:


Example use case:

snakeviz_exporter

This is the result when compiling the celshade example project, which takes a huge amount of time. About 3/4 of the time are taken away for the export of individual objects (and analyzing the results a bit more leads to the conclusion that the way bone animations are exported is horrendously slow because for each bone the entire scene is set to each frame resulting in a complete redrawing and recalculation of the scene).

This is a very small step for the Python side of things towards #870. The new Profile context manager can be used for other occasions as well and can even be nested, although it will mess a bit with the results. It should always be opt-in due to performance reasons.

I've also added a new util function to get a preference setting or a default value if it doesn't exist, which makes many of the current get_[something]() functions obsolete (they are still used though, that's not part of this PR).

@luboslenco luboslenco merged commit 91c98c7 into armory3d:master Oct 31, 2020
@luboslenco
Copy link
Member

Thanks!

the way bone animations are exported is horrendously slow because for each bone the entire scene is set to each frame

Yes it's very ugly, unfortunately I am not aware of other way. :(

@MoritzBrueckner
Copy link
Collaborator Author

I thought about manually iterating through the fcurves and combine the individual transformations to matrices, but I don't know if that works. First I have to understand Blender's animation system better. Would be really nice if Blender had a way to retrieve the matrices for arbitrary frames.

@MoritzBrueckner MoritzBrueckner deleted the profiler branch November 6, 2020 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants