What functions in the standard library can be implemented faster using software hacks?

I recently read an article on quick sqrt calculation. So I decided to ask the SO community and its experts to help me find out which STL algorithms or mathematical calculations can be implemented faster using software hacks?

It would be great if you could give examples or links.

Thanks in advance.

+5
source share
5 answers

Some algorithms <algorithm>can be optimized for vector<bool>::[const_]iterator. These include:

find
count
fill
fill_n
copy
copy_backward
move // C++0x
move_backward  // C++0x
swap_ranges
rotate
equal

, , . , ( ).

, , , STL. :

http://libcxx.llvm.org/

+2

, :

  • : !

  • : , .

  • : , . ?

  • : , Windows/x86/32bit.

, , . , , , , .

, , . , ...

EDIT:

:

  • / /: - . . - . .

  • : , , , , , .

+9

, .

: , ? , .

+7

. STL C. , , , . : , (a.k.a. )? , .

, , , . gnu multi-precision , . , , - , . , , .. .

, thkala, , GMP/MPIR , . . , , , .

. . , rijndael, , 2 8 , , uint8_t / xor. ? , , , . , . , . xor 8- , . . , rijndael , .

. , , . , STL , , , STL : , , , , .. , , STL . , , . , IO, IO. , "" // .

, , STL, "all round" .

, , - . , , - .

+2

. , - .

sqrt, , , .

, , . , . ( , !) Carmack , std::sqrt , .

12 , . , , , sqrt.

, , std::sqrt, , , , .

, , : . , , , , , , , , ..

, . , , , .

. , , . .

Now there is no doubt about the part of the standard library that could be optimized. I especially like the C ++ IOStreams library. It is often naively and very ineffectively implemented. The C ++ Committee Technical Report on C ++ Performance contains an entire chapter on how IOStreams can be implemented faster.

But this I / O, where performance is often considered "inconsequential."

For the rest of the standard library, you are unlikely to find much room for optimization.

+1
source

All Articles