[PATCH] Icons for: Tab functions

David Faure faure at kde.org
Tue Apr 11 17:30:32 BST 2006


On Friday 07 April 2006 01:55, James Richard Tyrer wrote:
> I note that the question of whether to make a string in a function 
> "static" is a trade off.  I was taught to avoid putting a string on the 
> stack (which is where a regular C string in a function will go if it 
> isn't "static").  You do save memory by using the stack, but at the 
> expense of some processing speed -- which is often the trade off. 

Right. But KDE runs through a lot of methods, so if they all kept their
data static, the memory consumption would be even bigger.
Speed in a user-triggered function doesn't matter -that- much that a QString
constructor would be a penalty.

> Without knowing exactly how QString works, I really couldn't say what 
> the optimum method is or whether declaring it:
> 
> 	QString tab_new_x="         " // 9 blanks
> 
> would improve performance or not.  It would with a standard C string  
> (which would be 10 characters: 9 blanks and a "\0"), since you would not 
> need to move the string to resize it (which is very messy if it is on 
> the stack) if you allocated enough space for the longest string that 
> would be stored there.

QString allocates data using new internally, it's not really on the stack
(only the wrapper is on the stack).

Thanks for the konq commit, looks fine.
We still have to sort out khtml - but not today, for me.

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).





More information about the kfm-devel mailing list