Re: [dev] [PATCH][RFC] Add a basic version of tr

From: <q_AT_c9x.me>
Date: Thu, 16 Jan 2014 22:58:29 +0100

On Thu, Jan 16, 2014 at 10:46:41AM +0000, sin wrote:
> On Thu, Jan 16, 2014 at 11:37:46AM +0100, Silvan Jegen wrote:
> > On Thu, Jan 16, 2014 at 10:16 AM, Roberto E. Vargas Caballero
> > <k0ga_AT_shike2.com> wrote:
> > >> I would still go for the function-pointer-less version of the
> > >> code since it actually is one line shorter, I think. The second,
> > >> function-pointer-less version of the code can be found below.
> > >
> > > I like more the version with the pointer function because you
> > > only have a copy of the loop and because the text segment of
> > > the executable will be smaller.
> >
> > I don't mind either way.
> >
> > Does anyone else have any strong feelings one way or the other?
>
> I also prefer the function pointer based version.
>

Using a function pointer can make code much better (it is advocated by
Pike); I mistakenly thought it would make the program slower because I
know indirect calls can be expensive and I first thought the loop was
character based.

It turns out that in this case this is not much of an issue, maybe
because GCC is able to inline anyway. If not, it might be possible to
observe a difference when running on a file full of very short lines.
Received on Thu Jan 16 2014 - 22:58:29 CET

This archive was generated by hypermail 2.3.0 : Thu Jan 16 2014 - 23:00:07 CET