Skip to content

Commit

Permalink
Performance improvements (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAyd authored Jan 17, 2024
1 parent ef4f656 commit 643a987
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions pantab/src/pantab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ template <typename T> class IntegralInsertHelper : public InsertHelper {
}

const int64_t value = ArrowArrayViewGetIntUnsafe(&array_view_, idx);
inserter_->add(static_cast<T>(value));
hyperapi::internal::ValueInserter{*inserter_}.addValue(
static_cast<T>(value));
}
};

Expand All @@ -129,7 +130,8 @@ template <typename T> class FloatingInsertHelper : public InsertHelper {
}

const double value = ArrowArrayViewGetDoubleUnsafe(&array_view_, idx);
inserter_->add(static_cast<T>(value));
hyperapi::internal::ValueInserter{*inserter_}.addValue(
static_cast<T>(value));
}
};

Expand All @@ -149,7 +151,7 @@ template <typename OffsetT> class Utf8InsertHelper : public InsertHelper {
ArrowArrayViewGetBytesUnsafe(&array_view_, idx);
auto result = std::string{buffer_view.data.as_char,
static_cast<size_t>(buffer_view.size_bytes)};
inserter_->add(result);
hyperapi::internal::ValueInserter{*inserter_}.addValue(result);
}
};

Expand Down Expand Up @@ -183,7 +185,7 @@ class Date32InsertHelper : public InsertHelper {
static_cast<int16_t>(1 + utc_tm.tm_mon),
static_cast<int16_t>(1 + utc_tm.tm_yday)};

inserter_->add(dt);
hyperapi::internal::ValueInserter{*inserter_}.addValue(dt);
}
};

Expand Down Expand Up @@ -237,11 +239,13 @@ class TimestampInsertHelper : public InsertHelper {

if constexpr (TZAware) {
hyperapi::OffsetTimestamp ts{dt, time, std::chrono::minutes{0}};
inserter_->add<hyperapi::OffsetTimestamp>(ts);
hyperapi::internal::ValueInserter{*inserter_}.addValue(
static_cast<hyperapi::OffsetTimestamp>(ts));

} else {
hyperapi::Timestamp ts{dt, time};
inserter_->add<hyperapi::Timestamp>(ts);
hyperapi::internal::ValueInserter{*inserter_}.addValue(
static_cast<hyperapi::Timestamp>(ts));
}
}
};
Expand Down

0 comments on commit 643a987

Please sign in to comment.