inefficient QString coding practice
Adriaan de Groot
adridg at cs.kun.nl
Sun Mar 14 16:01:39 GMT 2004
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sunday 14 March 2004 16:17, Dominique Devriese wrote:
> Adriaan de Groot writes:
> > The original claim by Juergen was that bleh == "foo" incurs a
> > considerable malloc / free and whatnot overhead and that it should
> > be kept in mind. As long as there's no numbers attached, neither
> > "doesn't really matter performance-wise" or "is important" can be
> > evaluated.
>
> I think we can be pretty sure that a low, constant number of extra
> instructions, and a low, constant number of extra malloc/free's
> multiplied by a very low, and also constant number of occurences of
> this practice won't matter much in the bigger image.
Numbers, man, numbers. Without numbers, your vague emoting of "very low, and
also constant" is just as meaningless as my "oodles". FWIW, there seem to be
351 occurrences in KMail, and some 1500 in all of kdepim. Since the relevance
of each can only be judged in context (is it in a loop? more important) these
numbers by themselves don't mean much either.
So to sum up this thread: there are certainly cases where == "" is a bad thing
due to the additional overhead, and people who genuinely care about
performance should keep an eye out for them. The average developer probably
_shouldn't_ worry about them unless string encoding or efficienct is
particularly important in her or his code. Patches related to the use of ==
"" should be welcomed.
- --
pub 1024D/FEA2A3FE 2002-06-18 Adriaan de Groot <groot at kde.org>
Would you like a freem?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)
iD4DBQFAVIHpdqzuAf6io/4RAoWmAJj2J8XfKpz1508bnlRnIY1Iuw7ZAJ4m0uuW
ERNq2BzXzPxAAc0tn+fL8g==
=GiFA
-----END PGP SIGNATURE-----
More information about the kde-core-devel
mailing list