[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdev-php] duchain: use imports cache for better performance
From:       Niko Sams <niko.sams () gmail ! com>
Date:       2014-01-06 16:45:47
Message-ID: E1W0DJD-0001HJ-Rc () scm ! kde ! org
[Download RAW message or body]

Git commit 3f115761d9f9b968804c0efc42583ee127859575 by Niko Sams.
Committed on 09/12/2013 at 18:53.
Pushed by nsams into branch 'master'.

use imports cache for better performance

For deals read this blog post:
http://www.nikosams.net/blog/7_kdevelop_php_performance_improvements

REVIEW: 114237

M  +8    -0    duchain/builders/contextbuilder.cpp
M  +1    -0    duchain/helper.cpp

http://commits.kde.org/kdev-php/3f115761d9f9b968804c0efc42583ee127859575

diff --git a/duchain/builders/contextbuilder.cpp b/duchain/builders/contextbuilder.cpp
index 134024e..46f2798 100644
--- a/duchain/builders/contextbuilder.cpp
+++ b/duchain/builders/contextbuilder.cpp
@@ -79,10 +79,14 @@ ReferencedTopDUContext ContextBuilder::build(const IndexedString& url, AstNode*
         updateContext->clearImportedParentContexts();
         updateContext->parsingEnvironmentFile()->clearModificationRevisions();
         updateContext->clearProblems();
+        updateContext->updateImportsCache();
     } else {
         kDebug() << "compiling" << url.str();
     }
     ReferencedTopDUContext top = ContextBuilderBase::build(url, node, updateContext);
+
+    top->updateImportsCache();
+
     return top;
 }
 
@@ -97,6 +101,8 @@ void ContextBuilder::startVisiting(AstNode* node)
     if (compilingContexts()) {
         TopDUContext* top = dynamic_cast<TopDUContext*>(currentContext());
         Q_ASSERT(top);
+        top->updateImportsCache(); //Mark that we will use a cached import-structure
+
         bool hasImports;
         {
             DUChainReadLocker lock(DUChain::lock());
@@ -110,8 +116,10 @@ void ContextBuilder::startVisiting(AstNode* node)
                 Q_ASSERT(false);
             } else {
                 top->addImportedParentContext(import);
+                top->updateImportsCache();
             }
         }
+
     }
     visitNode(node);
     if (m_openNamespaces) {
diff --git a/duchain/helper.cpp b/duchain/helper.cpp
index f3f40eb..5e01103 100644
--- a/duchain/helper.cpp
+++ b/duchain/helper.cpp
@@ -201,6 +201,7 @@ DeclarationPointer findDeclarationImportHelper(DUContext* currentContext, const
                 currentContext->topContext()->addImportedParentContext(top);
                 currentContext->topContext()->parsingEnvironmentFile()
                 ->addModificationRevisions(top->parsingEnvironmentFile()->allModificationRevisions());
+                currentContext->topContext()->updateImportsCache();
                 ifDebug(kDebug() << "using" << declarations[i].declaration()->toString() << top->url().str();)
                 return DeclarationPointer(declarations[i].declaration());
             }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic