mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: x86[_64] memset and rep stos
Date: Wed, 25 Feb 2015 10:20:20 +0100	[thread overview]
Message-ID: <20150225092020.GW32724@port70.net> (raw)
In-Reply-To: <CAOb3iui7DKTzqksZ0MW8ga1Ji4sa_QVZ7T-niFDARiRVZ_=LAg@mail.gmail.com>

* ?????? <torshie@gmail.com> [2015-02-25 15:54:31 +0800]:
> I'm not an expert on micro optimization, but why not use a dynamic
> routine selection system which would select the optimal routine for a
> given CPU during program initialization. The routine selection
> algorithm could simply be a predefined static table look up.
> IMO, only very small number of functions (like memset, memcpy) would
> benefit from such a system, so no code size overhead to worry about.

my guess is

- for static linking it adds at least an extra indirection
  and these functions often used with small input

- code size overhead: now you have to include all possible
  versions in libc.so

- for dynamic linking there is a load time dispatch mechanism:
  STT_GNU_IFUNC but it's broken due to lack of specs

- maintainance burden, hard to test

- selecting the right algorithm at runtime is not easy

but i guess eventually when more ppl use musl it will make sense
to add more target specific optimizations


  reply	other threads:[~2015-02-25  9:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-25  6:12 Rich Felker
2015-02-25  7:54 ` 邓尧
2015-02-25  9:20   ` Szabolcs Nagy [this message]
2015-02-25 17:26     ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150225092020.GW32724@port70.net \
    --to=nsz@port70.net \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).