From b2369973a4548a9dd341deb7a4a427e36f1fe640 Mon Sep 17 00:00:00 2001
From: Christian Kamm <christian.d.kamm@nokia.com>
Date: Wed, 20 Oct 2010 14:48:38 +0200
Subject: [PATCH] QmlJS: Fix a performance problem.

In order to determine all components that instantiate a given component,
Bind::usesQmlPrototype was called on each document in the snapshot.
That, in turn, had to iterate over all object definitions inside the
document, resolving their prototype references.

All in all, it lead to a very large amount of fairly expensive lookups
that were slowing down Creator considerably.

Reviewed-by: Erik Verbruggen
---
 src/libs/qmljs/qmljsbind.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/libs/qmljs/qmljsbind.cpp b/src/libs/qmljs/qmljsbind.cpp
index bc56065463b..76572957bd5 100644
--- a/src/libs/qmljs/qmljsbind.cpp
+++ b/src/libs/qmljs/qmljsbind.cpp
@@ -93,6 +93,9 @@ Interpreter::ObjectValue *Bind::findQmlObject(AST::Node *node) const
 bool Bind::usesQmlPrototype(ObjectValue *prototype,
                             const Context *context) const
 {
+    // ### This function is disabled for performance reasons.
+    return false;
+
     foreach (ObjectValue *object, _qmlObjects.values()) {
         const ObjectValue *resolvedPrototype = object->prototype(context);
 
-- 
GitLab