[PATCH] Add num_to_str() for speedup /proc/stat

From: KAMEZAWA Hiroyuki
Date: Mon Jan 30 2012 - 00:17:52 EST


On Thu, 26 Jan 2012 17:18:00 -0800
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:

> On Fri, 27 Jan 2012 10:09:33 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote:
>
> > > I expect most of these numbers are zero. I wonder if we would get
> > > useful speedups from
> > >
> > > for_each_irq_nr(j) {
> > > /* Apologetic comment goes here */
> > > if (kstat_irqs(j))
> > > seq_printf(p, " %u", kstat_irqs(j));
> > > else
> > > seq_puts(p, " 0");
> > > }
> >
> > Yes. This is very good optimization and shows much optimization.
> > I did this at first try but did complicated ones because it seems
> > not interesting. (This is my bad habit...)
> >
> > I'll try again and measure time.
>
> seq_puts() is too slow ;) I bet seq_putc(p, ' ');seq_putc(p, '0') will
> complete in negative time.


How about this ? I think this is simple enough.
=