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

-- 
  __ .  . __
 (o.\ \/ /.o) [EMAIL PROTECTED]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 7950090
 (;O/ \/ \O;)
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to