mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] direct coding of asctime_r
@ 2020-08-23  8:24 Jens Gustedt
  2020-08-23  9:33 ` Alexander Monakov
  2020-08-24 16:14 ` Rich Felker
  0 siblings, 2 replies; 8+ messages in thread
From: Jens Gustedt @ 2020-08-23  8:24 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 1299 bytes --]

Hello,
I don't know if you guys noticed, but sometime ago we voted some of
the ..._r functions from <time.h> into the C standard, just to then
discover that POSIX has deprecated the whole set of functions and
proposes to replace them by `strftime`.

One of the arguments to keep them, was that `asctime_r` does not need
access to locale and has a fixed format, and so can be implemented
with a much smaller footprint.

Looking into musl I found that the current implementation is basically
doing verbatim what the C standard says, namely uses `snprintf` under
the hood to do the formatting. This has obviously the disadvantage
that this drags the whole infrastructure that is needed for `snprintf`
into the executable.

Making some tests, I found that coding `asctime_r` straight forward
with byte-copying has it shave off about 10k from the final
executable.

Would it be interesting for musl to change to such an implementation?

Shall I prepare a patch to do so?

Jens

-- 
:: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536   ::
:: :::::::::::::::::::::: gsm France : +33 651400183   ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::

[-- Attachment #2: Digitale Signatur von OpenPGP --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-08-27 14:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-23  8:24 [musl] direct coding of asctime_r Jens Gustedt
2020-08-23  9:33 ` Alexander Monakov
2020-08-23  9:56   ` Jens Gustedt
2020-08-23 11:08     ` Alexander Monakov
2020-08-24 16:14 ` Rich Felker
2020-08-27  9:27   ` Jens Gustedt
2020-08-27 14:03     ` Rich Felker
2020-08-27 14:24       ` Jens Gustedt

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).