qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] const / static (against current CVS)


From: Doctor Bill
Subject: Re: [Qemu-devel] [PATCH] const / static (against current CVS)
Date: Wed, 24 Aug 2005 08:54:27 -0400

My own experience is the effect of these types of optimizations is
usually negligible, although it is still the first thing I do when
optimizing a program.  The main improvement I find is reducing the
time required to initialize variables and improved code readability. 
If you know values are constant, you do not need to reference how
there values are changing in a debugger...

Probably more important is to make sure none constant data structures
are done on the stack.  There is no good reason why any code page
should be read-write.

Bill

On 8/23/05, Andreas Mohr <address@hidden> wrote:
> Hello all,
> 
> Introduction part:
> ----------
> I'm doing a performance tuning effort all over the place in
> frequently-used Linux programs:
> I'm trying to mark as many data areas as possible const (and static)
> in various programs (at those places where it's actually feasible,
> that is).
> 
> This should have the following benefits:
> a) more .rodata (read-only) pages in programs, which means that
> pages (since they're read-only and can thus be restored from the binary any
> time) can simply be discarded instead of having to be paged out when
> free memory is getting low
> b) more page sharing between program instances due to less
> modified / read-write (and thus unique instance *per-program*!) memory pages
> c) various const compiler optimizations kicking in
> d) less linker work to be done (static)
> e) we detect previously silent memory corruption (random data area trashing)
> better
> 
> (use "objdump -x" to analyze what can be improved)
> 
> In smaller programs marking variables as const won't be enough to get
> several whole pages (4K size) back to read-only, but it goes into the
> right direction after all, since we don't intend to actually increase
> the number of read-write pages...
> ----------
> 
> This patch against current CVS adds const and/or static to numerous structs
> that obviously could be made so. It compiles without any warnings,
> and qemu even still runs! ;-)
> 
> Patch had been posted to "Patches Repository" on User Forum about a month
> ago, but of course that wasn't enough... (silly me)
> 
> Thank you,
> 
> Andreas Mohr
> (patch attached)
> 
> --
> GNU/Linux. It's not the software that's free, it's you.
> 
> 
> _______________________________________________
> Qemu-devel mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
> 
> 
> 
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]