This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: FW: [PATCH][STEP 2] ctype changes for removing locale structures
- From: Freddie Chopin <freddie_chopin at op dot pl>
- To: Jaap de Wolff <info at jasoon dot nl>, newlib at sourceware dot org
- Date: Fri, 09 Feb 2018 20:23:33 +0100
- Subject: Re: FW: [PATCH][STEP 2] ctype changes for removing locale structures
- Authentication-results: sourceware.org; auth=none
- References: <003d01d3a1b7$925a12a0$b70e37e0$@jasoon.nl> <49712025-8019-e0e7-901d-c8e2472fdf3c@LGSInnovations.com> <006301d3a1d1$1f681cf0$5e3856d0$@jasoon.nl>
On Fri, 2018-02-09 at 19:09 +0100, Jaap de Wolff wrote:
> In basic the intention of my patches is to make to memory footprint
> for embedded environment small.
> I talked about locale, and a part of the locale definition is a
> lookup table with the characteristics of each character.
> Of course it is possible to move the lookup table outside the locale,
> but then the lookup table still takes 257 bytes of memory.
>
> In the beginning my intention was just to move the __global_locale
> table from ram to rom, and a reaction was that that was not enough
> when using embedded processors with 2K or even 1K of ROM and 128
> bytes of RAM.
>
> I do think that for the intended users of the REENT_SMALL computation
> speed (efficiency) is less important as memory.
> So I replaces all usage of a lookup table by a (kind of) computation.
I use REENT_SMALL on pretty decent ARM microcontrollers, so I would not
fit that description. Anyway - your change won't work with a chip that
has 128 bytes of memory anyway, as small reent would take ~95% of it. I
don't think a chip that has 1 or 2 kB of flash and 128 bytes of RAM is
a good target for writing firmware in C using a generic library like
newlib. If newlib will try to please everybody, finally it won't be
good for anyone...
I'm for some sort of configurable locale removal, so I have nothing
against this particular patches, just don't make reent-small something
that is slow an inefficient. For me reent-small is about the amount of
RAM used, not speed - a difference between ~1 kB vs ~110 bytes is quite
significant, especially if you actually need almost nothing from reent,
even more so in case of multithreaded apps...
Regards,
FCh