diag: 拆分"写临时文件"与"acisIn"计时,判定内存读取不值得做
修完回写后开图期仍有 1733 次临时文件写入,需要判断"改内存读取"能省多少。 在 RegionAcisInDwgInFields 与 CoreTools::StringToRegion 两个重载里,把 "写临时文件+关闭"和"AcDbBody::acisIn"拆成独立计时(RegIn.write / RegIn.acisIn / Str2Reg.write / Str2Reg.acisIn)。 实测(big1.dwg,93 s 开图,1733 次未命中): RegIn.write 374 次 70.5 ms 189 us RegIn.acisIn 374 次 1422.0 ms 3.80 ms Str2Reg.write 1359 次 267.7 ms 197 us Str2Reg.acisIn 1359 次 5999.5 ms 4.41 ms 结论:写文件合计 338 ms,只占 9.6 s 恢复耗时的 3.5%;杀软扫描已在 write 的 190 us 里 (Defender 在关闭时扫)。即使完全省掉文件往返,上限也只有 0.3~0.5 s(开图的 0.4%)。 而 AcDbBody::acisIn 在 R19~R26 只有文件名重载,真要内存解析只能改存盘格式走 acdbModelerRestoreEntityFromDwgFiler(即暂缓的 Phase 3)。因此不做。 剩余 7.4 s 是纯解析(1733 次 × 4.3 ms),只能靠减少次数;text 通道 1560 个唯一文本 是真实不同的截面,命中率已接近上限。继续提速应转向 Parasolid 绘制那条线。 数据与结论已写入 pipe-section-region-performance-plan.md。 本次只加诊断计时(Debug + AEC_PERF_COUNTER=1 才生效),不改任何业务行为。
This commit is contained in:
1 parent
3c18a715a4
commit
56c89c5fa4
3 files changed
+60
-10
No files matched your search
@@ -3564,8 +3564,11 @@ AcDbRegion* CoreTools::StringToRegion(const CString & sRegionScrp)
|
||||
|
||||
if (file.Open(sFullPath, CFile::modeCreate | CFile::modeWrite))
|
||||
{
|
||||
file.Write(sNewSrc.c_str(), sizeof(char) * (UINT)sNewSrc.size());
|
||||
file.Close();
|
||||
{
|
||||
SectionPerf::Scope w("Str2Reg.write");
|
||||
file.Write(sNewSrc.c_str(), sizeof(char) * (UINT)sNewSrc.size());
|
||||
file.Close();
|
||||
}
|
||||
SectionPerf::NoteTempFile(sNewSrc.size());
|
||||
}
|
||||
else
|
||||
@@ -3577,7 +3580,11 @@ AcDbRegion* CoreTools::StringToRegion(const CString & sRegionScrp)
|
||||
|
||||
AcDbRegion *pReg(NULL);
|
||||
AcDbVoidPtrArray arBodyPtrs;
|
||||
Acad::ErrorStatus es(AcDbBody::acisIn(sFullPath, arBodyPtrs));
|
||||
Acad::ErrorStatus es(Acad::eOk);
|
||||
{
|
||||
SectionPerf::Scope r("Str2Reg.acisIn");
|
||||
es = AcDbBody::acisIn(sFullPath, arBodyPtrs);
|
||||
}
|
||||
if (Acad::eOk == es)
|
||||
{
|
||||
if (arBodyPtrs.length() > 0)
|
||||
@@ -3646,8 +3653,11 @@ AcDbRegion *CoreTools::StringToRegion(Adesk::UInt64 nLen, char *pszReg)
|
||||
CFile file;
|
||||
if (file.Open(sFullPath, CFile::modeCreate | CFile::modeWrite))
|
||||
{
|
||||
file.Write(sNewSrc.c_str(), sizeof(char) * (UINT)sNewSrc.size());
|
||||
file.Close();
|
||||
{
|
||||
SectionPerf::Scope w("Str2Reg.write");
|
||||
file.Write(sNewSrc.c_str(), sizeof(char) * (UINT)sNewSrc.size());
|
||||
file.Close();
|
||||
}
|
||||
SectionPerf::NoteTempFile(sNewSrc.size());
|
||||
}
|
||||
else
|
||||
@@ -3658,7 +3668,11 @@ AcDbRegion *CoreTools::StringToRegion(Adesk::UInt64 nLen, char *pszReg)
|
||||
}
|
||||
|
||||
AcDbVoidPtrArray arBodyPtrs;
|
||||
Acad::ErrorStatus es(AcDbBody::acisIn(sFullPath, arBodyPtrs));
|
||||
Acad::ErrorStatus es(Acad::eOk);
|
||||
{
|
||||
SectionPerf::Scope r("Str2Reg.acisIn");
|
||||
es = AcDbBody::acisIn(sFullPath, arBodyPtrs);
|
||||
}
|
||||
if (Acad::eOk == es)
|
||||
{
|
||||
if (arBodyPtrs.length() > 0)
|
||||
@@ -3760,7 +3774,11 @@ AcDbSurface *CoreTools::StringToFace(Adesk::UInt64 nLen, char *pszBody)
|
||||
}
|
||||
|
||||
AcDbVoidPtrArray arBodyPtrs;
|
||||
Acad::ErrorStatus es(AcDbBody::acisIn(sFullPath, arBodyPtrs));
|
||||
Acad::ErrorStatus es(Acad::eOk);
|
||||
{
|
||||
SectionPerf::Scope r("Str2Reg.acisIn");
|
||||
es = AcDbBody::acisIn(sFullPath, arBodyPtrs);
|
||||
}
|
||||
if (Acad::eOk == es)
|
||||
{
|
||||
if (arBodyPtrs.length() > 0)
|
||||
|
||||
Reference in new issue
Block a user