Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 25 Feb 2015 10:20:20 +0100
From: Szabolcs Nagy <>
Subject: Re: x86[_64] memset and rep stos

* ?????? <> [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

- 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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.