什么是可以更快地编程的黑客实施的标准库中的函数? [英] What are the functions in the standard library that can be implemented faster with programming hacks?

查看:98
本文介绍了什么是可以更快地编程的黑客实施的标准库中的函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近读到有关快速开方运算的文章。因此,我决定问这么社区及其高手帮我看看,这STL算法或数学计算可以更快地编程的黑客实施?

I have recently read an article about fast sqrt calculation. Therefore, I have decided to ask SO community and its experts to help me find out, which STL algorithms or mathematical calculations can be implemented faster with programming hacks?

这将是巨大的,如果你能给出例子或链接。

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

在此先感谢。

推荐答案

若干的算法<算法> 可以矢量&lt优化;布尔> :: [const_]迭代器。这些措施包括:

Several of the algorithms in <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

我可能已经错过了一些。但所有上述算法可以被优化以在许多比特在一时间,而不是在一个时间只有一个位工作(如将一个幼稚的实现)。

I've probably missed some. But all of the above algorithms can be optimized to work on many bits at a time instead of just one bit at a time (as would a naive implementation).

这是一种优化,我怀疑是严峻的大多数STL实现失踪。它不是从这个丢失:

This is an optimization that I suspect is sorely missing from most STL implementations. It is not missing from this one:

http://libcxx.llvm.org/

这篇关于什么是可以更快地编程的黑客实施的标准库中的函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆