gpt4 book ai didi

c - 避免为标准目的使用定制算法。有助于自动并行化

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:34:29 24 4
gpt4 key购买 nike

Avoid the use of tailored algorithms for standard purposes: For example, certain applications benefit marginally from complex sorting algorithms tailored to the characteristics of the data being sorted. Replacing these with calls to standard library sorting algorithms can facilitate their replacement with standard parallelized library calls.

谁能举个例子。

最佳答案

我认为作者是在提倡使用现有的便利抽象,而不是为已经具备高性能的操作生成高度可并行化的代码;在同样的意义上,我们通常被推荐使用 List 接口(interface)而不是 Arrays;即使数组可以提高性能。

Replacing these with calls to standard library sorting algorithms can facilitate their replacement with standard parallelized library calls.

因此,从标准算法和类开始,只有在适当确定性能瓶颈时才创建您自己的优化。使用标准库可以在以后轻松更改算法,例如通过子类化

关于c - 避免为标准目的使用定制算法。有助于自动并行化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5202848/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com