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

Mitchell Stokes mogurijin at gmail.com
Tue Dec 6 08:12:28 CET 2011


Hello devs,

I was doing some profiling on an animation stress test scene in the
BGE. I found that around 20% (18.8% in my last run) of the time was
spent on looking up RNA paths (RNA_path_resolve). The way fcurves are
currently executed, they each store a path and an index for array
properties like location and rotation. Each fcurve is executed
separately from from the others so each for each fcurve there is a
call to RNA_path_resolve. This means 3 calls for one bone for position
and 4 calls for one bone for rotation (using quats). So, for one bone,
this are 7 calls that can be reduced to 2. Assuming each bone with
fcurves has position and rotation curves, this would reduce the calls
to RNA_path_resolve by about 71%.

That covers the why, but I need help with the how. Creating a version
of animsys_write_rna_setting() that works with arrays would be easy
enough, but I'm not sure how to handle groups of fcurves at a time. I
know there are groups in an action, but I don't think bAction::groups
represents all the curves in bAction::curves. Also, it seems to me
that a curve can belong to multiple groups, and that the curves in a
group don't necessarily all use the same RNA path. Any thoughts?

Thanks,
Mitchell Stokes


More information about the Bf-committers mailing list