top | item 33780459

(no title)

fsfod | 3 years ago

MSVC recently added there own version[1] of it controlled with a [[msvc::dispatch]] attribute thats needs an experimental compiler flag I think still.

1: C++ Function Multiversioning in Windows https://www.youtube.com/watch?v=LTM1was1dTU

discuss

order

janwas|3 years ago

Interesting, did not know that, thanks.

It seems to me that a table of function pointers is all that's required. Highway is a little fancier in that the first entry is a trampoline that first detects CPU capabilities and then calls your pointer; subsequent calls go straight to the appropriate function.

Do the (experimental/non-portable) compiler versions contribute any additional value?

eesmith|3 years ago

> ... contribute any additional value?

I gather from the linked-to video that binary-load-time selection has better run-time performance than init-at-first-call run-time dispatch, and doesn't have the tradeoff between performance and security.