Debugger: Work on WatchModel performance

Don't instantiate repeating boilerplate item data in some
cases (such as large arrays).

This makes it necessary to access parent WatchItems in
a lot more cases than before and needs another separation of
WatchItem/WatchModel code to keep the dumper autotests
in a functional state.

For a plain std::vector<int> with 1 mio items this reduces
 extraction time from more than 2 minutes to about 3 seconds.

Change-Id: I175c5f6ee90434a6e85342d8bb71bd10a04dd271
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
hjk
2015-12-16 17:17:38 +01:00
parent 768b775f52
commit 7de7eb6bca
19 changed files with 878 additions and 912 deletions

View File

@@ -1089,11 +1089,11 @@ void QmlEngine::updateCurrentContext()
context = stackHandler()->currentFrame().function;
} else {
QModelIndex currentIndex = inspectorView()->currentIndex();
const WatchData *currentData = watchHandler()->watchItem(currentIndex);
const WatchItem *currentData = watchHandler()->watchItem(currentIndex);
if (!currentData)
return;
const WatchData *parentData = watchHandler()->watchItem(currentIndex.parent());
const WatchData *grandParentData = watchHandler()->watchItem(currentIndex.parent().parent());
const WatchItem *parentData = watchHandler()->watchItem(currentIndex.parent());
const WatchItem *grandParentData = watchHandler()->watchItem(currentIndex.parent().parent());
if (currentData->id != parentData->id)
context = currentData->name;
else if (parentData->id != grandParentData->id)
@@ -1351,7 +1351,9 @@ void QmlEnginePrivate::handleEvaluateExpression(const QVariantMap &response,
QmlV8ObjectData body = extractData(bodyVal);
WatchHandler *watchHandler = engine->watchHandler();
auto item = new WatchItem(iname, exp);
auto item = new WatchItem;
item->iname = iname;
item->name = exp;
item->exp = exp.toLatin1();
item->id = body.handle;
bool success = response.value(_("success")).toBool();
@@ -2170,9 +2172,11 @@ void QmlEnginePrivate::handleFrame(const QVariantMap &response)
{
QByteArray iname = "local.this";
QString exp = QLatin1String("this");
auto item = new WatchItem(iname, exp);
QmlV8ObjectData objectData = extractData(body.value(_("receiver")));
auto item = new WatchItem;
item->iname = iname;
item->name = exp;
item->id = objectData.handle;
item->type = objectData.type;
item->value = objectData.value.toString();