[Bf-committers] I need help reducing RNA lookups for fcurves

Mitchell Stokes mogurijin at gmail.com
Tue Dec 6 10:05:22 CET 2011

On Tue, Dec 6, 2011 at 12:13 AM, Joshua Leung <aligorith at gmail.com> wrote:

> While there are some inefficiencies here, for reference, how much of
> the rest of the time was spent by other areas? Was this the sole
> largest time sink, or is it one of the "easiest" to tackle first?

About half of the time spent updating animations (excluding mesh
deformation) is spent in RNA_path_resolve(). So this seemed like a
good area to try and optimize.

> I think several things need clarification here.
> - bAction.curves represents ALL of the F-Curves that action has. All
> of the grouped ones appear first, in the order in which the groups
> they belong to exist. These are then followed by the ungrouped curves
> (which these days usually consist of those F-Curves which got created
> via inserting keys directly on buttons instead of via a Keying Set).

> - A single F-Curve can only ever belong to one group at a time. If you
> find a file where this is not the case, I'm afraid that it would've
> been stuck in an infinite loop on file load.
> - Indeed, there is absolutely no guarantee that curves in a single
> path belong to the same RNA Path. Although we currently by default end
> up with all the F-Curves for a single bone in a single group (and the
> F-Curves for other bones in other groups respectively), it could be
> equally possible (if a user created their own hand-crafted Keying
> Sets) that they have a situation where they've got F-Curves from
> multiple bones in the same group. Even in the first case here, you'd
> still have some location and some rotation (in the typical case) per
> group.
> And one last thing: be very careful whenever you start trying to deal
> with caches. Outdated or too frequently refreshing caches are a very
> common problem, and one that can we should be all to aware of.

Thanks for the clarifications. At the moment I'm trying to avoid
caching since what I really want to do is reuse the result from
RNA_path_resolve() for any other fcurves using the same path. Here is
some code I'm playing with:

If you notice, animsys_write_rna_setting_array() avoids extra calls to

Mitchell Stokes

More information about the Bf-committers mailing list