本文介绍了STL /升压LLVM SmallVector的相同呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直想看看是否有数据,许多小载体的时候我可以优化的情况下。在我的使用情况下,存在可能是这些载体的100,000+所以矢量存储的大小是至关重要的。每一个可以只具有在时间1或2的元素,但在许多情况下,可能会变得更大容量。

I have been trying to see if I can optimize the case when having many small vectors of data. In my use case there may be 100,000+ of these vectors so the size of the vector storage is critical. Each may only have 1 or 2 elements at times but may grow larger capacities in many cases.

我已经用一个简单的std :: vector的尝试,但,这是令人难以置信的缓慢,因为它分配在堆中其内存浪费N个小缓冲和时间太长需要在时间紧迫的环境。有效的载体的小缓冲优化(SBO)似乎看起来像一个可行的解决方案。这意味着载体的内部(即,叠层)数据被使用,直到它被超过,然后才确实堆需要使用

I have tried using a simple std::vector but this is incredibly slow as it allocates N small buffers on the heap which wastes memory and takes far too long in a time-critical environment. Effectively a small-buffer-optimization (SBO) on a vector seems to look like a viable solution. This means the internal (i.e. stack) data of the vector is used until it is exceeded and only then does the heap need to be used.

我已经在这似乎恰恰如此的LLVM SmallVector绊倒了。然而,似乎有说不完的LLVM框架内的相关性,并想知道如果在升压类似的东西?有可能是SBO优化的加速实施执行的可能性,但在我的搜索,我不能找到这个的任何引用。我已经看到,STL实现技术上禁止形式,虽然这样做优化由于对迭代器一些规则,但?

I have stumbled upon the LLVM SmallVector which appears to do exactly that. It however appears to have lots of dependencies within the LLVM framework and was wondering if there is something similar in Boost? There may be a possibility SBO optimization is performed by the Boost implementation but I cannot find any references to this in my searches. I have seen that the STL implementation is technically prohibited form doing this optimization though due to some rule about iterators though?

链接: SmallVector是内部源$ C ​​$ c将LLVM软件。

Link: The LLVM SmallVector is in the internal source code to the LLVM software.

推荐答案

首先,你一定能提取LLVM的SmallVector,它具有依赖性和自由的许可证的pretty少量。据我所知,有SmallVector没有STL /升压直接等同。有富丽小的矢量类,但是()

First, you can surely extract LLVM's SmallVector, it has pretty small amount of dependencies and liberal license. As far as I know, there is no STL/Boost direct equivalent of SmallVector. There is small vector class in Folly though (https://github.com/facebook/folly)

这篇关于STL /升压LLVM SmallVector的相同呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 15:45