[prev in list] [next in list] [prev in thread] [next in thread]
List: quanta-devel
Subject: Re: [quanta-devel] Class Variables - no attrAutoCompleteAfter patch
From: Andras Mantia <amantia () kde ! org>
Date: 2007-02-15 9:13:41
Message-ID: 200702151113.41493.amantia () kde ! org
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
So the comments. ;-)
Optimization issues:
+ if (s.find('(') == -1)
+ qTag->type="variable";
+ else
+ qTag->type="function";
This can be optimized because a few lines before there is :
qTag->setName(s.left(s.find('(')));
Caching the result of s.find('(') makes sense, especially that this is
time critical code.
Again, a micro optimization would be to do the next test
+ if(qTag->type == "variable" && qTag->className.length() != 0)
inside the "if ... else" above. qTag->type can only be "variable" if
s.find('(') returns -1, right?
Some optimizations are needed below as well: cache the result
of "tagWholeLineStr.mid(tagWholeLineStr.find('\n')+1,tagWholeLineStr.length())".
String operations are usually expensive.
"tagWholeLineStr.find('\n')" can be cached as well.
Similar issues a few lines below.
If the variable is a function argument, maybe we shouldn't put in the
userTagsList at all, instead of resetting the className? I'm unsure
which version is better.
In the completion code, I don't understand something. You set
completion.type = type[tagNameList[i]];
But this will be wrong for XML, as in case of XML, type is unitialized.
Shouldn't this be moved inside the
+ if(completionDTD->family==Script)
?
This is what I could spot looking at the code, and except the last
issue, the rest is I assume before you are not so familiar with C++
(and KDE) coding practices.
I didn't test it yet, but I will do after you comment on the last part.
If you provide an updated patch with the optimizations, that is even
better.:-)
Andras
--
Quanta Plus developer - http://quanta.kdewebdev.org
K Desktop Environment - http://www.kde.org
[Attachment #5 (application/pgp-signature)]
_______________________________________________
quanta-devel mailing list
quanta-devel@kde.org
https://mail.kde.org/mailman/listinfo/quanta-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic