减少 new 构建,使用代理字段和算法优化 LeoMapper 查询性能。
NMSAzulX opened this issue · 0 comments
NMSAzulX commented
@alexinea 该段代码实现应该得到优化,ToLeoMemberMetadataScript
DictBase<> 的代理类中提供查询方法,由 BTFTree 算法来实现:
private readonly static LeoMember _leoMember_Foo;
private readonly static LeoMember _leoMember_Name;
public LeoMember GetMember(string memberName)
{
//leoScriptDict :
//leoDict -> leoScriptDict<"Name","return _leoMember_Name;">
//leoDict -> leoScriptDict<"Foo","return _leoMember_Foo;">
//BTFTree Script :
//logical from : script = BTFTemplate.GetGroupPrecisionPointBTFScript(leoScriptDict, "memberName");
}
//静态填充方法
public static void FillLeoMapper(Dict<string,LeoMember> dict)
{
_leoMember_Foo = dict["Foo"];
.......
}
在构建完成后使用动态代码调用 FillLeoMapper方法
NDelegate.Random().Action<Dict<string,LeoMember>>("type.FillLeoMapper(arg);")();