From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Jenkins Date: Wed, 05 Nov 2008 23:04:27 +0000 Subject: Re: [PATCH] udevd: Shrink struct token to 12 bytes Message-Id: <4912267B.1000305@tuffmail.co.uk> List-Id: References: <4911FA4F.2000900@tuffmail.co.uk> In-Reply-To: <4911FA4F.2000900@tuffmail.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org Kay Sievers wrote: > On Wed, Nov 5, 2008 at 20:55, Alan Jenkins wrote: > >> Signed-off-by: Alan Jenkins >> >> diff --git a/udev/udev-rules.c b/udev/udev-rules.c >> > > I liked the 16 byes, and now we can have only 255 keys per rule. :) > Hmm, that wasn't my intention. rule.token_count is a short so it should be good for 64k. You'd hit the line buffer limit first. > I get now with: "shrunk to 81012 bytes tokens (6751 * 12 bytes), 68009 > bytes buffer". Maybe we should check the duplicates in the strings and > tail of strings while parsing, we can get rid of another 20kb, I > guess. :) > Not sure about the O(n^2) scanning though. I tried a trie, but it's 100+ lines of dense C and needs a hundred K or so during parsing - it just seemed like overkill. It did shave ~15K off my ~25K string buffer. I can send it if you like.