CalculateTimed in any ruleset currently looks like this:
public static ErrorCode CalculateTimed(OsuDifficultyCalculatorHandle calcHandle, ModsCollectionHandle modsHandle,
NativeTimedOsuDifficultyAttributes* nativeTimedAttributesBuffer, int* bufferSize)
{
DifficultyCalculatorContext<OsuDifficultyCalculator> context = calcHandle.Resolve();
Mod[] mods = modsHandle.IsNull ? [] : [.. modsHandle.Resolve().Select(x => x.ToMod(context.Ruleset))];
if (nativeTimedAttributesBuffer is null)
{
*bufferSize = context.Beatmap.GetPlayableBeatmap(context.Ruleset.RulesetInfo, mods).HitObjects.Count;
return ErrorCode.BufferSizeQuery;
}
List<TimedDifficultyAttributes> attributes = context.Calculator.CalculateTimed(mods);
NativeTimedOsuDifficultyAttributes[] nativeAttributes = [.. attributes.Select(x => new NativeTimedOsuDifficultyAttributes(x))];
BufferHelper.Write(nativeAttributes, nativeTimedAttributesBuffer, bufferSize);
return ErrorCode.Success;
}
Due to the way timed difficulty calculation works, the assumption can be made that the amount of hit objects in the beatmap is equal to the amount of timed difficulty attributes. But in order to retrieve said hit object count, the beatmap needs to be created using GetPlayableBeatmap, as mods or ruleset conversion can cause the amount to change, and thus they need to be applied. This is a rather expensive conversion, and it is desired to find an alternative approach to this.
The same operation is performed in the difficulty calculator when performing a calculation. There might be potential in making use of said operation here, but it is not clear how it could work. #14 might indirectly help with finding a solution here.
CalculateTimedin any ruleset currently looks like this:Due to the way timed difficulty calculation works, the assumption can be made that the amount of hit objects in the beatmap is equal to the amount of timed difficulty attributes. But in order to retrieve said hit object count, the beatmap needs to be created using
GetPlayableBeatmap, as mods or ruleset conversion can cause the amount to change, and thus they need to be applied. This is a rather expensive conversion, and it is desired to find an alternative approach to this.The same operation is performed in the difficulty calculator when performing a calculation. There might be potential in making use of said operation here, but it is not clear how it could work. #14 might indirectly help with finding a solution here.