[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: QString or QCString for file names?
From: Waldo Bastian <bastian () ens ! ascom ! ch>
Date: 1999-06-24 10:32:23
[Download RAW message or body]
Pietro Iglio wrote:
> There is at least a filename stored for each menu entry, both in
> the application menu and in the kdisknav menu, plus two pixmaps
> names (large/small) and a comment for each entry.
Are just the filenames stored or the full path? Are they stored
as URLs?
> If you use intensively kdisknav you can easily allocate, eg.,
> 150 menu entries. Considering an average length of 10 chars for
> each filename, you can save something if you don't use QString.
Let's see 4 filenames * 150 entries = 600 entries.
With QString:
Assuming an average length of 10 chars:
Approx. 40 bytes per string.
Approx. 24000 bytes.
Assuming an average length of 30 chars (including path):
Approx. 100 bytes per string.
Approx. 60000 bytes.
Possible memory use when using simple char *:
Assuming an average length of 10 chars:
Approx. 10 bytes per string.
Approx. 6000 bytes. (Saves 18K)
Assuming an average length of 30 chars (including path):
Approx. 30 bytes per string.
Approx. 18000 bytes. (Saves 42K)
I don't think 42K is worth to bother. It would be if it could
be saved in every application, but your normally run only 1 instance
of kpanel anyway. If you have 1500 menu entries instead
of 150 it could be worth it.
Does that happen?
> > With respect to CPU:
> > Profile your code to see where the problems are. Guessing about
> > performance problems is plain stupid. (Though very populair)
>
> You are right, this is the general rule. However, it is not really
> easy to profile the time spent for all qstring operations, unless
> you have a block profiler.
I tried gprof some time ago but it doesn't really seem to understand
the code very well.
Cheers,
Waldo
--
KDE, A New Millennium, A New Desktop http://www.kde.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic