Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

Progress with SearchTree class

<< < (4/5) > >>

Ceniza:
Hmmm, I just tried enabling "follow global includes" to parse the NewBuild project file and it didn't shut down.

Times look good though. I'll be waiting for that baby in SVN :)

But wait! I disabled "follow global includes", it re-paresed with no problem, re-enabled that option, started re-parsing but Code::Blocks is now sucking 50% CPU (100% if it hadn't HT enabled) and is just stuck there. Seems like a bug somewhere...

Der Meister:
Looks really nice, great work  :)
But you should also add it to the linux make system. Without it the compilation process doesn't abort (I wonder why this is the case) but Code::Blocks failes to load the plugin. After adding the two new source-files to the build system and re-compiling the plugin it seems to work fine. (Yet, I didn't check if the problem with "follow global includes" occures here, too.)
Thus, you should apply this little patch:

--- Code: ---Index: src/plugins/codecompletion/Makefile.am
===================================================================
--- src/plugins/codecompletion/Makefile.am      (revision 1584)
+++ src/plugins/codecompletion/Makefile.am      (working copy)
@@ -24,7 +24,8 @@
                        parser/parser.cpp \
                        parser/parserthread.cpp \
                        parser/token.cpp \
-                       parser/tokenizer.cpp
+                       parser/tokenizer.cpp \
+                       parser/searchtree.cpp
 
 noinst_HEADERS = cclist.h \
                        cclistctrl.h \
@@ -37,4 +38,5 @@
                        parser/parser.h \
                        parser/parserthread.h \
                        parser/token.h \
-                       parser/tokenizer.h
+                       parser/tokenizer.h \
+                       parser/searchtree.h

--- End code ---

rickg22:
Ah! Thanks for that one, I didn't know you had to do this, too.

rickg22:
Here's some profiling on the codecompletion plugin. Results are interesting...


Flat profile:

Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total           
 time   seconds   seconds    calls  ms/call  ms/call  name   
 15.79      0.12     0.12 32143644     0.00     0.00  wxStringBase::at(unsigned int) const
 13.16      0.22     0.10 32143644     0.00     0.00  wxString::GetChar(unsigned int) const
  7.89      0.28     0.06  7299941     0.00     0.00  Tokenizer::IsEOF() const
  6.58      0.33     0.05    66867     0.00     0.00  Tokenizer::CompactSpaces(wxString&) const
  5.26      0.37     0.04 25016299     0.00     0.00  Tokenizer::CurrentChar() const
  5.26      0.41     0.04    69053     0.00     0.00  Tokenizer::SkipBlock(char const&)
  3.95      0.44     0.03  6016913     0.00     0.00  Tokenizer::MoveToNextChar(unsigned int)
  2.63      0.46     0.02  1454827     0.00     0.00  wxString::append(unsigned int, char)
  2.63      0.48     0.02  1060893     0.00     0.00  wxStringBase::empty() const
  2.63      0.50     0.02   818659     0.00     0.00  wxString::operator char const*() const
  2.63      0.52     0.02   444750     0.00     0.00  Tokenizer::DoGetToken()
  2.63      0.54     0.02   108887     0.00     0.00  SearchTreeNode::GetDeepestMatchingPosition(BasicSearchTree*, wxString const&, unsigned int)
  1.32      0.55     0.01  6489068     0.00     0.00  wxStringBase::size() const
  1.32      0.56     0.01  2880137     0.00     0.00  wxStringBase::at(unsigned int)
  1.32      0.57     0.01  2880137     0.00     0.00  wxString::operator[](unsigned int)
  1.32      0.58     0.01  2809196     0.00     0.00  Tokenizer::NotEOF() const
  1.32      0.59     0.01  1520388     0.00     0.00  wxString::~wxString()
  1.32      0.60     0.01  1454827     0.00     0.00  wxString::operator<<(char)
  1.32      0.61     0.01   687707     0.00     0.00  wxBaseArrayPtrVoid::operator[](unsigned int) const
  1.32      0.62     0.01   669131     0.00     0.00  TokensArray::operator[](unsigned int) const
  1.32      0.63     0.01   460889     0.00     0.00  wxStringData::Lock()
  1.32      0.64     0.01   423075     0.00     0.00  std::_Rb_tree<char, std::pair<char const, unsigned int>, std::_Select1st<std::pair<char const, unsigned int> >, std::less<char>, std::allocator<std::pair<char const, unsigned int> > >::_S_key(std::_Rb_tree_node<std::pair<char const, unsigned int> > const*)
  1.32      0.65     0.01   368749     0.00     0.00  __gnu_cxx::__normal_iterator<SearchTreeNode**, std::vector<SearchTreeNode*, std::allocator<SearchTreeNode*> > >::operator+(int const&) const
  1.32      0.66     0.01   245572     0.00     0.00  std::_Rb_tree<char, std::pair<char const, unsigned int>, std::_Select1st<std::pair<char const, unsigned int> >, std::less<char>, std::allocator<std::pair<char const, unsigned int> > >::end()
  1.32      0.67     0.01   122763     0.00     0.00  std::vector<SearchTreeNode*, std::allocator<SearchTreeNode*> >::size() const
  1.32      0.68     0.01   116830     0.00     0.00  BasicSearchTree::GetNode(unsigned int, bool)
  1.32      0.69     0.01    97276     0.00     0.00  operator==(wxString const&, char const*)
  1.32      0.70     0.01    76280     0.00     0.00  wxString::append(wxString const&)
  1.32      0.71     0.01    25307     0.00     0.00  BasicSearchTree::FindNode(wxString const&, unsigned int, SearchTreePoint*)
  1.32      0.72     0.01    25185     0.00     0.00  SearchTree<TokensArray>::GetItemAtPos(unsigned int)
  1.32      0.73     0.01    14523     0.00     0.00  std::_Rb_tree<unsigned int, std::pair<unsigned int const, unsigned int>, std::_Select1st<std::pair<unsigned int const, unsigned int> >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, unsigned int> > >::_M_get_node()
  1.32      0.74     0.01    10563     0.00     0.00  void std::_Construct<std::pair<char const, unsigned int>, std::pair<char const, unsigned int> >(std::pair<char const, unsigned int>*, std::pair<char const, unsigned int> const&)
  1.32      0.75     0.01       11     0.91     2.34  Parser::AddTreeNamespace(wxTreeCtrl&, wxTreeItemId const&, Token*)
  1.32      0.76     0.01        1    10.00    10.29  BasicSearchTree::~BasicSearchTree()
  0.00      0.76     0.00  8478747     0.00     0.00  wxStringBase::GetStringData() const


The rest of the functions and methods give zero time.

280Z28:
Hey rick rev1587 is not compiling. You have these two lines in searchtree.cpp (223, 232):


--- Code: ---            result << _T("    <item depth=\"") << u2s(item->first) << _T("\" itemid=\"" << u2s(item->second) <<  "\"") << _T(" />\n");

            result << _T("    <child char=\"") << SerializeString(string(link->first)) << _T("\" nodeid=\"" << u2s(link->second) <<  "\"") << _T(" />\n");

--- End code ---

That I think should be this:


--- Code: ---            result << _T("    <item depth=\"") << u2s(item->first) << _T("\" itemid=\"") << u2s(item->second) <<  _T("\"") << _T(" />\n");

            result << _T("    <child char=\"") << SerializeString(string(link->first)) << _T("\" nodeid=\"") << u2s(link->second) <<  _T("\"") << _T(" />\n");

--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version