From: Doctor Bill <docbill@gmail.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] const / static (against current CVS)
Date: Wed, 24 Aug 2005 08:54:27 -0400 [thread overview]
Message-ID: <23bcb8700508240554653c7ff0@mail.gmail.com> (raw)
In-Reply-To: <20050823174026.GA27203@rhlx01.fht-esslingen.de>
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 <andi@rhlx01.fht-esslingen.de> 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
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
>
>
>
>
next prev parent reply other threads:[~2005-08-24 13:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-23 17:40 [Qemu-devel] [PATCH] const / static (against current CVS) Andreas Mohr
2005-08-24 3:24 ` Mulyadi Santosa
2005-08-24 12:54 ` Doctor Bill [this message]
2005-08-24 13:41 ` Paul Brook
2005-08-24 14:38 ` Andreas Mohr
2005-08-24 14:49 ` Paul Brook
2005-08-24 16:49 ` Doctor Bill
2005-08-24 20:35 ` Jamie Lokier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=23bcb8700508240554653c7ff0@mail.gmail.com \
--to=docbill@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.