Building the FCurve keyframes one at a time leads to quadratic runtime
behavior due to how the underlying BezTriple array is resized in
`animrig::insert_bezt_fcurve`. Instead, pre-allocate the entire array
upfront and assign the keyframes directly since we are already iterating
our time samples in-order.
In the event that fewer keyframes are ultimately assigned, rare since
this indicates some form of bad data which we skip during iteration, we
will reallocate to the appropriate size right before recalculating the
fcurve handles.
Total import time for the 3000 frame Elephant test asset [1] drops from
~4650 ms to 120 ms, a 38x speedup. A more typical 250 frame armature
animation shows a more modest 1.5-2x reduction in overall import time.
[1] https://github.com/usd-wg/assets/tree/main/full_assets/ElephantWithMonochord
Pull Request: https://projects.blender.org/blender/blender/pulls/131921