From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Jenkins Date: Tue, 11 Nov 2008 20:14:35 +0000 Subject: Re: [PATCH] udevd: Shrink struct token to 12 bytes Message-Id: <4919E7AB.50004@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 Thu, Nov 6, 2008 at 00:04, Alan Jenkins wrote: > >> 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. >> > > Ah, you are right, it's a short. Yeah, even with 255 we would hit the > line buffer probably. :) > > >>> 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. >> > > Hmm, maybe it's not worth, and may cost too much at bootup. But if you > have it working, I would like to see how much it is here. But don't > bother if it's too much effort, we will probably not apply that. > I had another go and got the index down to ~25K for my installation. So I guess it's worth having a look at.