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

View file

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

View file

@ -84,6 +84,8 @@ namespace IDE.ui
List<QueuedDisplayChange> mQueuedDisplayChanges = new List<QueuedDisplayChange>() ~ delete _;
List<InlineWidgetEntry> mInlineWidgets = new List<InlineWidgetEntry>() ~ delete _;
public int32 mHoverWatchLine;
public float mLastInlineMinY;
public float mLastInlineMaxY;
public override SourceEditWidget EditWidget
{
@ -198,9 +200,9 @@ namespace IDE.ui
}
}
public override void Update()
public override void UpdateAll()
{
base.Update();
base.UpdateAll();
var editData = mOutputWidget.mEditWidgetContent.mData;
@ -211,6 +213,8 @@ namespace IDE.ui
Debug.Assert(lineStartZero <= editData.mTextLength);
}
bool hasNewInlineWidgets = false;
UpdateHoverWatch();
if (mQueuedText.Length > 0)
{
@ -232,7 +236,7 @@ namespace IDE.ui
if (queuedDisplayChange.mWidget != null)
{
var widget = queuedDisplayChange.mWidget;
mOutputWidget.mEditWidgetContent.AddWidget(queuedDisplayChange.mWidget);
hasNewInlineWidgets = true;
mOutputWidget.Content.GetLineCharAtIdx(startLen + queuedDisplayChange.mOfs, out line, out lineChar);
mOutputWidget.Content.GetTextCoordAtLineChar(line, lineChar, var xOfs, var yOfs);
@ -257,6 +261,27 @@ namespace IDE.ui
mQueuedText.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)