Roland Mainz wrote:
Adam Leventhal wrote:
On Tue, Mar 06, 2007 at 04:37:59PM +0100, [EMAIL PROTECTED] wrote:
Ok.  I'll bite... what is a "tail merging string".  And does this save
space (as I think the name implies)?
Suppose you have two strings:

      Permission Denied.
      You're not authorized.  Permission Denied.

If the strings can be modified, you need to store both.
Any bets on how much space this will save in the kernel (or anywhere)? My
guess is fewer than 100 bytes.

I think this is more in the range of megabytes since the kernel is full
of duplicate strings.

Quick look at the problem (kernel only):
-- snip --
# scan all kernel files and dump all strings (or things which look like
strings)
$ cat $(find /kernel /usr/kernel /platform -type f) | strings -a | wc -c
 15951405
# scan all kernel files for string-like stuff and remove duplicates
$ cat $(find /kernel /usr/kernel /platform -type f) | strings -a | sort
-u | wc -c
 5342818
$ bc -l
(15951405-5342818) / (1024 * 1024)
10.11713695526123046875
-- snip --
In theory we could save ~~10.1MB in the kernel (userland is likely much
worse).

Note that "strings -a" lists lots of garbage which isn't really strings
which means the number will be below 10.1MB. Another limiting factor is
that we cannot fold multiple string literals across module borders but I
guess we can still save 3-5MB minimum.

The number could be improved a little bit by adding a compiler option to
fold all identical+duplicate read-only which will save some more memory.
----

Bye,
Roland




If you're going to do this sort of estimation, you need to be accurate.

1) don't count 32 and 64 binaries together
2) don't attempt to find strings in places where they cannot
   be eliminated (eg don't pass -a to strings).

On b60 32 bit binaries I get a potential savings of 886K -
a non-trivial amount of memory, but also a non-trivial amount
of work.

% strings `find /kernel /usr/kernel /platform -type f | egrep -v "amd64|conf"` | wc -c
 4302262

% strings `find /kernel /usr/kernel /platform -type f | egrep -v "amd64|conf"` | sort -u | wc -c
 3415519


- Bart

--
Bart Smaalders                  Solaris Kernel Performance
[EMAIL PROTECTED]               http://blogs.sun.com/barts
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to