[<prev] [next>] [day] [month] [year] [list]
Message-Id: <200711081457.32211.vda.linux@googlemail.com>
Date: Thu, 8 Nov 2007 14:57:32 -0700
From: Denys Vlasenko <vda.linux@...glemail.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH] printk: trivial optimizations
Hi Andrew,
This patch exploits some optimization opportunities
similar to those in first two patches I sent a while ago.
In particular:
In arch/x86/boot/printf.c gets rid of unused tail of digits:
const char *digits = "0123456789abcdefghijklmnopqrstuvwxyz";
(we are using 0-9a-f only)
Uses smaller/faster lowercasing (by ORing with 0x20)
if we know that we work on numbers/digits. Makes
strtoul smaller, and also we are getting rid of
static const char small_digits[] = "0123456789abcdefx";
static const char large_digits[] = "0123456789ABCDEFX";
since this works equally well:
static const char digits[16] = "0123456789ABCDEF";
Size savings:
$ size vmlinux.org vmlinux
text data bss dec hex filename
877320 112252 90112 1079684 107984 vmlinux.org
877048 112252 90112 1079412 107874 vmlinux
It may be also a tiny bit faster because code has less
branches now, but I doubt it is measurable.
Patch is run-tested.
Signed-off-by: Denys Vlasenko <vda.linux@...glemail.com>
--
vda
View attachment "linux-2.6.24-rc2-printf.patch" of type "text/x-diff" (6152 bytes)
Powered by blists - more mailing lists