Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions cpp/src/arrow/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <string>

#include "arrow/status.h"
#include "arrow/util/bit-util.h"
#include "arrow/util/macros.h"
#include "arrow/util/visibility.h"

Expand Down Expand Up @@ -204,7 +205,8 @@ class ARROW_EXPORT BufferBuilder {

Status Append(const uint8_t* data, int64_t length) {
if (capacity_ < length + size_) {
RETURN_NOT_OK(Resize(length + size_));
int64_t new_capacity = BitUtil::NextPower2(length + size_);
RETURN_NOT_OK(Resize(new_capacity));
}
UnsafeAppend(data, length);
return Status::OK();
Expand All @@ -213,7 +215,8 @@ class ARROW_EXPORT BufferBuilder {
// Advance pointer and zero out memory
Status Advance(int64_t length) {
if (capacity_ < length + size_) {
RETURN_NOT_OK(Resize(length + size_));
int64_t new_capacity = BitUtil::NextPower2(length + size_);
RETURN_NOT_OK(Resize(new_capacity));
}
memset(data_ + size_, 0, static_cast<size_t>(length));
size_ += length;
Expand Down
18 changes: 18 additions & 0 deletions cpp/src/arrow/builder-benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,22 @@ static void BM_BuildStringDictionary(
sizeof(int32_t));
}

static void BM_BuildBinaryArray(benchmark::State& state) { // NOLINT non-const reference
const int64_t iterations = 1 << 20;

std::string value = "1234567890";
while (state.KeepRunning()) {
BinaryBuilder builder(default_memory_pool());
for (int64_t i = 0; i < iterations; i++) {
ABORT_NOT_OK(builder.Append(value));
}
std::shared_ptr<Array> out;
ABORT_NOT_OK(builder.Finish(&out));
}
// Assuming a string here needs on average 2 bytes
state.SetBytesProcessed(state.iterations() * iterations * value.size());
}

BENCHMARK(BM_BuildPrimitiveArrayNoNulls)->Repetitions(3)->Unit(benchmark::kMicrosecond);
BENCHMARK(BM_BuildVectorNoNulls)->Repetitions(3)->Unit(benchmark::kMicrosecond);
BENCHMARK(BM_BuildAdaptiveIntNoNulls)->Repetitions(3)->Unit(benchmark::kMicrosecond);
Expand All @@ -166,4 +182,6 @@ BENCHMARK(BM_BuildAdaptiveUIntNoNulls)->Repetitions(3)->Unit(benchmark::kMicrose
BENCHMARK(BM_BuildDictionary)->Repetitions(3)->Unit(benchmark::kMicrosecond);
BENCHMARK(BM_BuildStringDictionary)->Repetitions(3)->Unit(benchmark::kMicrosecond);

BENCHMARK(BM_BuildBinaryArray)->Repetitions(3)->Unit(benchmark::kMicrosecond);

} // namespace arrow
1 change: 1 addition & 0 deletions cpp/src/arrow/python/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// under the License.

#include "arrow/python/platform.h"

#include "arrow/python/config.h"

namespace arrow {
Expand Down
5 changes: 3 additions & 2 deletions cpp/src/plasma/store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -690,8 +690,9 @@ int main(int argc, char* argv[]) {
close(shm_fd);
if (system_memory > shm_mem_avail) {
ARROW_LOG(FATAL) << "System memory request exceeds memory available in /dev/shm. The "
"request is for " << system_memory
<< " bytes, and the amount available is " << shm_mem_avail
"request is for "
<< system_memory << " bytes, and the amount available is "
<< shm_mem_avail
<< " bytes. You may be able to free up space by deleting files in "
"/dev/shm. If you are inside a Docker container, you may need to "
"pass "
Expand Down