Animation: Disable NLA mapping if no NLA tracks are present #110306

Merged
Christoph Lendenfeld merged 4 commits from ChrisLend/blender:performance_nla_mapping into main 2023-07-27 09:31:50 +02:00

The drawing code executed NLA mapping code even though there were no tracks to be mapped.

Disabling this takes the draw_fcurve function from ~1130μs to ~985μs (heavy example scene with dense data)
Of course this only applies when not using the NLA.
And the performance benefit is larger, the more curves are on screen

The drawing code executed NLA mapping code even though there were no tracks to be mapped. Disabling this takes the `draw_fcurve` function from ~1130μs to ~985μs (heavy example scene with dense data) Of course this only applies when not using the NLA. And the performance benefit is larger, the more curves are on screen
Christoph Lendenfeld added 1 commit 2023-07-20 16:25:41 +02:00
Christoph Lendenfeld requested review from Nate Rupsis 2023-07-20 16:38:25 +02:00
Christoph Lendenfeld added the
Module
Animation & Rigging
label 2023-07-20 16:38:33 +02:00
Christoph Lendenfeld requested review from Sybren A. Stüvel 2023-07-20 16:39:33 +02:00
Christoph Lendenfeld added this to the Animation & Rigging project 2023-07-20 16:39:40 +02:00
Member

Curious to know how you profiled.

Curious to know how you profiled.
Nate Rupsis approved these changes 2023-07-20 20:14:28 +02:00
Nate Rupsis left a comment
Member

What a nice little improvement :)

What a nice little improvement :)
Author
Member

Curious to know how you profiled.

to find the slowdowns I used Hotspot on linux
to get actual performance times I used simple delta time prints using std::chrono::high_resolution_clock::now()

> Curious to know how you profiled. to find the slowdowns I used Hotspot on linux to get actual performance times I used simple delta time prints using `std::chrono::high_resolution_clock::now()`
Sybren A. Stüvel reviewed 2023-07-21 10:39:50 +02:00
Sybren A. Stüvel left a comment
Member

Now I'm curious. What are the timings you get when you move the check into ANIM_nla_mapping_apply_fcurve()? The current optimisation creates a stronger binding between the caller and that function's implementation, which IMO is not the best way forward. My hypothesis is that putting this at the start of the function would be enough to get the speedup. At least it should get rid of the cost per displayed FCurve.

void ANIM_nla_mapping_apply_fcurve(AnimData *adt, FCurve *fcu, bool restore, bool only_keys)
{
  /* Don't bother iterating all FCurves if this function is not going to do anything anyway. */
  if (adt == nullptr || BLI_listbase_is_empty(&adt->nla_tracks)) {
    return;
  }
  // ... rest of the function 
}
Now I'm curious. What are the timings you get when you move the check into `ANIM_nla_mapping_apply_fcurve()`? The current optimisation creates a stronger binding between the caller and that function's implementation, which IMO is not the best way forward. My hypothesis is that putting this at the start of the function would be enough to get the speedup. At least it should get rid of the cost per displayed FCurve. ```cpp void ANIM_nla_mapping_apply_fcurve(AnimData *adt, FCurve *fcu, bool restore, bool only_keys) { /* Don't bother iterating all FCurves if this function is not going to do anything anyway. */ if (adt == nullptr || BLI_listbase_is_empty(&adt->nla_tracks)) { return; } // ... rest of the function } ```
Author
Member

@dr.sybren very good idea! shaved off another 70μs per curve
There were 2 more calls to that function below that I missed, having the if within the function itself of course also included them

@dr.sybren very good idea! shaved off another 70μs per curve There were 2 more calls to that function below that I missed, having the if within the function itself of course also included them
Christoph Lendenfeld added 1 commit 2023-07-21 16:06:19 +02:00
Sybren A. Stüvel approved these changes 2023-07-24 11:42:07 +02:00
Christoph Lendenfeld added 2 commits 2023-07-27 09:27:17 +02:00
Christoph Lendenfeld merged commit f7570c5ef4 into main 2023-07-27 09:31:50 +02:00
Christoph Lendenfeld deleted branch performance_nla_mapping 2023-07-27 09:31:52 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#110306
No description provided.