1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Improved performance with lots of raw leaks displayed

This commit is contained in:
Brian Fiete 2021-12-06 12:35:13 -08:00
parent 6cf0152d99
commit 09bf85ad0e
3 changed files with 48 additions and 16 deletions

View file

@ -421,8 +421,13 @@ void BFGC::RawShutdown()
gDbgErrorString = errorStr; gDbgErrorString = errorStr;
gDbgErrorString += "\n"; gDbgErrorString += "\n";
int passLeakCount = 0;
for (auto& rawLeak : mSweepInfo.mRawLeaks) for (auto& rawLeak : mSweepInfo.mRawLeaks)
{ {
if (passLeakCount == 20000) // Only display so many...
break;
Beefy::String typeName; Beefy::String typeName;
if (rawLeak.mRawAllocData->mType != NULL) if (rawLeak.mRawAllocData->mType != NULL)
typeName = rawLeak.mRawAllocData->mType->GetFullName() + "*"; typeName = rawLeak.mRawAllocData->mType->GetFullName() + "*";
@ -451,6 +456,8 @@ void BFGC::RawShutdown()
if (gDbgErrorString.length() < 256) if (gDbgErrorString.length() < 256)
gDbgErrorString += StrFormat(" %s\n", leakStr.c_str()); gDbgErrorString += StrFormat(" %s\n", leakStr.c_str());
passLeakCount++;
} }
BF_ASSERT(mSweepInfo.mLeakCount > 0); BF_ASSERT(mSweepInfo.mLeakCount > 0);

View file

@ -12309,16 +12309,16 @@ namespace IDE
} }
hadMessages = true; hadMessages = true;
int paramIdx = msg.IndexOf(' '); int paramIdx = msg.IndexOf(' ');
String cmd = scope String(); StringView cmd = default;
String param = scope String(); StringView param = default;
if (paramIdx > 0) if (paramIdx > 0)
{ {
cmd.Append(msg, 0, paramIdx); cmd = msg.Substring(0, paramIdx);
param.Append(msg, paramIdx + 1); param = msg.Substring(paramIdx + 1);
} }
else else
cmd.Append(msg); cmd = msg;
bool isOutput = (cmd == "msg") || (cmd == "dbgEvalMsg") || (cmd == "log"); bool isOutput = (cmd == "msg") || (cmd == "dbgEvalMsg") || (cmd == "log");
if (cmd == "msgLo") if (cmd == "msgLo")
@ -12356,7 +12356,7 @@ namespace IDE
while (true) while (true)
{ {
String errorMsg = null; StringView errorMsg = default;
int infoPos = param.IndexOf("\x01"); int infoPos = param.IndexOf("\x01");
if (infoPos == 0) if (infoPos == 0)
@ -12368,7 +12368,7 @@ namespace IDE
if (endPos == -1) if (endPos == -1)
break; break;
String leakStr = scope String(param, 1, endPos - 1); String leakStr = scope String(param, 1, endPos - 1);
param.Remove(0, endPos + 1); param.RemoveFromStart(endPos + 1);
int itemIdx = 0; int itemIdx = 0;
for (var itemView in leakStr.Split('\t')) for (var itemView in leakStr.Split('\t'))
{ {
@ -12410,12 +12410,12 @@ namespace IDE
tempStr.Clear(); tempStr.Clear();
tempStr.Append(param, 0, infoPos); tempStr.Append(param, 0, infoPos);
errorMsg = tempStr; errorMsg = tempStr;
param.Remove(0, infoPos); param.RemoveFromStart(infoPos);
} }
else else
errorMsg = param; errorMsg = param;
if (errorMsg != null) if (!errorMsg.IsEmpty)
{ {
if (isFirstMsg) if (isFirstMsg)
{ {
@ -12427,19 +12427,19 @@ namespace IDE
mOutputPanel.Update(); mOutputPanel.Update();
} }
OutputLineSmart(scope String("ERROR: ", errorMsg)); OutputLineSmart(scope String("ERROR: ", scope String(errorMsg)));
if (gApp.mRunningTestScript) if (gApp.mRunningTestScript)
{ {
// The 'OutputLineSmart' would already call 'Fail' when running test scripts // The 'OutputLineSmart' would already call 'Fail' when running test scripts
} }
else else
{ {
Fail(errorMsg); Fail(scope String(errorMsg));
} }
isFirstMsg = false; isFirstMsg = false;
} }
else else
Output(errorMsg); Output(scope String(errorMsg));
} }
if (infoPos == -1) if (infoPos == -1)

View file

@ -84,6 +84,8 @@ namespace IDE.ui
List<QueuedDisplayChange> mQueuedDisplayChanges = new List<QueuedDisplayChange>() ~ delete _; List<QueuedDisplayChange> mQueuedDisplayChanges = new List<QueuedDisplayChange>() ~ delete _;
List<InlineWidgetEntry> mInlineWidgets = new List<InlineWidgetEntry>() ~ delete _; List<InlineWidgetEntry> mInlineWidgets = new List<InlineWidgetEntry>() ~ delete _;
public int32 mHoverWatchLine; public int32 mHoverWatchLine;
public float mLastInlineMinY;
public float mLastInlineMaxY;
public override SourceEditWidget EditWidget public override SourceEditWidget EditWidget
{ {
@ -198,10 +200,10 @@ namespace IDE.ui
} }
} }
public override void Update() public override void UpdateAll()
{ {
base.Update(); base.UpdateAll();
var editData = mOutputWidget.mEditWidgetContent.mData; var editData = mOutputWidget.mEditWidgetContent.mData;
int lineStartZero = -1; int lineStartZero = -1;
@ -211,6 +213,8 @@ namespace IDE.ui
Debug.Assert(lineStartZero <= editData.mTextLength); Debug.Assert(lineStartZero <= editData.mTextLength);
} }
bool hasNewInlineWidgets = false;
UpdateHoverWatch(); UpdateHoverWatch();
if (mQueuedText.Length > 0) if (mQueuedText.Length > 0)
{ {
@ -232,7 +236,7 @@ namespace IDE.ui
if (queuedDisplayChange.mWidget != null) if (queuedDisplayChange.mWidget != null)
{ {
var widget = queuedDisplayChange.mWidget; var widget = queuedDisplayChange.mWidget;
mOutputWidget.mEditWidgetContent.AddWidget(queuedDisplayChange.mWidget); hasNewInlineWidgets = true;
mOutputWidget.Content.GetLineCharAtIdx(startLen + queuedDisplayChange.mOfs, out line, out lineChar); mOutputWidget.Content.GetLineCharAtIdx(startLen + queuedDisplayChange.mOfs, out line, out lineChar);
mOutputWidget.Content.GetTextCoordAtLineChar(line, lineChar, var xOfs, var yOfs); mOutputWidget.Content.GetTextCoordAtLineChar(line, lineChar, var xOfs, var yOfs);
@ -257,6 +261,27 @@ namespace IDE.ui
mQueuedText.Clear(); mQueuedText.Clear();
mQueuedDisplayChanges.Clear(); mQueuedDisplayChanges.Clear();
} }
float minY = -mOutputWidget.mEditWidgetContent.mY;
float maxY = minY + mOutputWidget.mHeight;
if ((gApp.mIsUpdateBatchStart) || (hasNewInlineWidgets) || (mLastInlineMinY != minY) || (mLastInlineMaxY != maxY))
{
for (var inlineWidget in ref mInlineWidgets)
{
bool isVisible = (inlineWidget.mWidget.mY + inlineWidget.mWidget.mHeight >= minY) && (inlineWidget.mWidget.mY < maxY);
if ((inlineWidget.mWidget.mParent != null) != isVisible)
{
if (isVisible)
mOutputWidget.mEditWidgetContent.AddWidget(inlineWidget.mWidget);
else
inlineWidget.mWidget.RemoveSelf();
}
}
mLastInlineMinY = minY;
mLastInlineMaxY = maxY;
}
} }
public void WriteSmart(StringView text) public void WriteSmart(StringView text)