This is the mail archive of the
mailing list for the newlib project.
RE: [PATCH newlib]New configuration option disable io vector buffer in Newlib
- From: "Bin Cheng" <bin dot cheng at arm dot com>
- To: <newlib at sourceware dot org>
- Date: Wed, 27 Mar 2013 17:22:16 +0800
- Subject: RE: [PATCH newlib]New configuration option disable io vector buffer in Newlib
- References: <002a01ce2a0a$96b77c90$c42675b0$ at email@example.com> <3862C5643B15B6468269546753EB2A9208493996 at BLTSXVS01 dot govsolutions dot com> <003501ce2abd$6dca67d0$495f3770$ at firstname.lastname@example.org> <20130327090655 dot GB6433 at calimero dot vinschen dot de>
> -----Original Message-----
> From: email@example.com [mailto:firstname.lastname@example.org] On
> Behalf Of Corinna Vinschen
> Sent: Wednesday, March 27, 2013 5:07 PM
> To: email@example.com
> Subject: Re: [PATCH newlib]New configuration option disable io vector buffer
> in Newlib
> On Mar 27 15:33, Bin Cheng wrote:
> > > -----Original Message-----
> > > From: firstname.lastname@example.org
> > > [mailto:email@example.com] On Behalf Of Howland Craig D
> > > (Craig)
> > > Sent: Tuesday, March 26, 2013 9:25 PM
> > > To: firstname.lastname@example.org
> > > Subject: RE: [PATCH newlib]New configuration option disable io
> > > vector
> > buffer
> > > in Newlib
> > >
> > > > From: email@example.com
> > > > [mailto:firstname.lastname@example.org]
> > > On Behalf Of Bin Cheng
> > > > Sent: Tuesday, March 26, 2013 6:14 AM
> > > >
> > > > Hi,
> > > > Stream IO functions in Newlib construct structures like
> > > > __suio/__siov,
> > > then
> > > > call function __sfvwrite_r to do the buffered IO. From the view of
> > > > MCU programs, this layer code of vector buffer occupies large
> > > > amount flash
> > > and
> > > > is generally unnecessary. So here this patch introduces a new
> > > configuration
> > > > time option "--disable-newlib-fvwrite-in-streamio" allowing user
> > > > to
> > > disable
> > > > io vector buffer in Newlib, thus reduces foot-print of stream-io
> > > > and formatted IO.
> > > > ... It has also been applied in the release of "GNU Tools for ARM
> > > Embedded
> > > > Processors" and used in many projects I believe.
> > > >
> > > > Is it OK or any suggestions?
> > >
> > > Can you provide numbers of how much size savings were realized?
> > >
> > > Is there also a run-time efficiency gain because a layer has been removed?
> > >
> > > I suggest that an explanation of this new option with its benefits
> > > and drawbacks be added somewhere. (Does it rate mention in HOWTO?)
> > > It's easy
> > to
> > > envision that a new user comes to take Newlib 3 months from now, and
> > > would
> > not
> > > even know that this option existed. And even if they were to read
> > configure,
> > > the "disable iov in streamio" description would mean little or
> > > nothing to
> > most
> > > people.
> > >
> > Thanks for suggestions. As for the changes:
> > For code size, this patch reduces about 2+KB text section with below
> > command line for a simple formatted IO program:
> > $ arm-none-eabi-gcc -mthumb -mcpu=cortex-m0 -Os -ffcuntion-sections
> > -fdata-sections -Wl,--gc-sections -lc -lnosys -lc main.c -o main.exe
> > The library itself is build with "-Os -ffunction-sections -fdata-sections".
> > For performance, I measured a formatted IO test which calls lots of
> > "snprintf" and runs for about 10Secs. Turns out this patch can improve
> > performance about 5~6%, but I won't claim how good the patch is
> > because it's just one use-case.
> > As for how-to document, I am not sure how to handle it. There are a
> > bunch of "--disable/enable-*" options, but neither HOWTO nor README mentions
> > Maybe we could re-factor the document and find a place to describe
> > these options in detail.
> Yes, that's a bummer. I think we could really need somebody who would be
> willing to add all these options to the README file with a bit of explanation
> what each of them is doing.
I did investigation on how those options work before, maybe I can take this work later. I have some other patches to reduce code size, I can get back to this once I finish them.