Re: Class Variables - no attrAutoCompleteAfter patch
Andras Mantia <[email protected]> Thu, 15 Feb 2007 11:13:41 +0200
| Newsgroups | gmane.comp.kde.devel.quanta |
|---|---|
| Message-ID | <[email protected]> |
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
_______________________________________________
quanta-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/quanta-devel
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQBF1CRFTQdfac6L/08RAuOyAKDjM9Mgra7dJjleJjH2DRR9kBMGLQCfTKxj a4JruBDrm9tFUGjEhzRo5kM= =2Qtg -----END PGP SIGNATURE-----