[UE5-0][python api] add any keys to float curves of anim sequence is very slowly

hi,
with unreal engine 5.0.3, i wanna create any blendshape curve of animation sequenece from json data.
codes :

import unreal
import os,json,sys,math,time

    def _tv_float_curves(self,anim_sequence,node,curve_dict):
        times=unreal.Array(float)
        values=unreal.Array(float)
        node_name = node.split(':')[-1]
        for _index in curve_dict.keys():
            curve_name = curve_dict[_index]['DisplayName']
            tvp = curve_dict[_index]['Keys']
            times=tvp['Time']
            values=tvp['Value']
            # default from time 0 to end
            if times == []:
                for n in range(len(values)):
                    times.append(n/self.frame_rate)
            self.first_time = times[0]
            if len(list(set(values)))==1:
                times=[times[0]-self.first_time]
                values=[values[0]]
            floatCurve=unreal.AnimationLibrary.add_curve(anim_sequence, 
            curve_name, curve_type=unreal.RawCurveTrackTypes.RCT_FLOAT, 
            meta_data_curve=False)
            #print(curve_name, times, values)
            new_times = self._move_times_to_zero(times)
            unreal.AnimationLibrary.add_float_curve_keys(anim_sequence, curve_name, new_times, values)
        unreal.log_flush()
        return

It is very very slowly more than UE4.
in the source code
\UnrealEngine\Engine\Source\Runtime\Engine\Private\Animation\AnimSequence.cpp
Anyone be removed like old modules FloatCurve.AddKey(args).

We need to loop through this statement, adding any curves.Restore the performance with UE4 old version,please!

unreal.AnimationLibrary.add_float_curve_keys(anim_sequence, curve_name, new_times, values)


It is a bug in UE5.

The Function: Engine\Source\Editor\AnimationBlueprintLibrary\Private\AnimationBlueprintLibrary.cpp
Function:  -> AddCurveKeysInternal

AddCurveKeysInternal(UAnimSequence* AnimationSequence, FName CurveName, const TArray& richCurveKeys, ERawCurveTrackTypes CurveType)

I fixed it.
from

AddCurveKeysInternal(UAnimSequence* AnimationSequence, FName CurveName, const TArray<float>& Times, const TArray<DataType>& KeyData,ERawCurveTrackTypes CurveType)
{
...
for (int32 KeyIndex = 0; KeyIndex < NumKeys; ++KeyIndex)
	{
		Controller.SetCurveKey(CurveId, { Times[KeyIndex], Values[KeyIndex] });
	}
}

to

AddCurveKeysInternal(UAnimSequence* AnimationSequence, FName CurveName, const TArray<FRichCurveKey>& richCurveKeys, ERawCurveTrackTypes CurveType)
{
...
Controller.SetCurveKeys(CurveId, richCurveKeys);
}

compile and enjoy!

Hi, I have a question to ask, I am using
unreal.AnimationLibrary.add_float_curve_keys(anim_sequence, curve_name, new_times, values)
The curve can be set normally in this function, but the animation is not applied in the editor. It only changes after I manually adjust the Value.
Do you know why this is?