You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@arrow.apache.org by "Ben Kietzman (Jira)" <ji...@apache.org> on 2020/03/06 17:42:00 UTC

[jira] [Created] (ARROW-8022) [C++] Provide or Vendor a small_vector implementation

Ben Kietzman created ARROW-8022:
-----------------------------------

             Summary: [C++] Provide or Vendor a small_vector implementation
                 Key: ARROW-8022
                 URL: https://issues.apache.org/jira/browse/ARROW-8022
             Project: Apache Arrow
          Issue Type: Improvement
          Components: C++
    Affects Versions: 0.16.0
            Reporter: Ben Kietzman
            Assignee: Ben Kietzman
             Fix For: 1.0.0


{{small_vector<>}} is a C++ utility class which does not use heap allocation for small numbers of elements. [Folly|https://github.com/facebook/folly/blob/master/folly/docs/small_vector.md], [Boost|https://github.com/boostorg/container/blob/develop/include/boost/container/small_vector.hpp], [Abseil|https://github.com/abseil/abseil-cpp/blob/master/absl/container/inlined_vector.h], and [LLVM|https://llvm.org/doxygen/classllvm_1_1SmallVector.html] each provide one.

In many cases a vector usually has few elements but might have many. If we use std::vector we have to bother the allocator unless the vector is actually empty. My specific use case for this is field lookup by name: I expect that most schemas will have unique field names, but strictly speaking we support duplicate field names. It would be ideal not incur a performance penalty for 99.9% of field lookups which yield 0 or 1 fields just to accommodate the case where there may be multiple.







--
This message was sent by Atlassian Jira
(v8.3.4#803005)