Fix performance regression

This commit is contained in:
Antoine Pitrou committed 2018-04-05 12:29:35 +02:00
1 parent b238d3e469
commit 3ebb34f723
5 files changed
+12 -15

No files matched your search

+1 -1
View File
@@ -173,7 +173,7 @@ struct ARROW_EXPORT PyBytesView {
PyBytesView(const char* b, Py_ssize_t s, PyObject* obj = nullptr)
: bytes(b), size(s), ref(obj) {}
Status FromBinary(PyObject* obj, const std::string& expected_msg) {
Status FromBinary(PyObject* obj, const char* expected_msg) {
if (PyBytes_Check(obj)) {
this->bytes = PyBytes_AS_STRING(obj);
this->size = PyBytes_GET_SIZE(obj);
-9
View File
@@ -196,15 +196,6 @@ Status DecimalMetadata::Update(PyObject* object) {
return Update(precision, scale);
}
bool PyFloat_IsNaN(PyObject* obj) {
return PyFloat_Check(obj) && std::isnan(PyFloat_AsDouble(obj));
}
bool PandasObjectIsNull(PyObject* obj) {
return obj == Py_None || obj == numpy_nan || PyFloat_IsNaN(obj) ||
(internal::PyDecimal_Check(obj) && internal::PyDecimal_ISNAN(obj));
}
} // namespace internal
} // namespace py
} // namespace arrow
+10
View File
@@ -21,6 +21,7 @@
#include <typeinfo>
#include "arrow/python/common.h"
#include "arrow/python/decimal.h"
#include "arrow/python/helpers.h"
#include "arrow/util/logging.h"
@@ -323,6 +324,15 @@ template Status CIntFromPython(PyObject*, uint16_t*, const std::string&);
template Status CIntFromPython(PyObject*, uint32_t*, const std::string&);
template Status CIntFromPython(PyObject*, uint64_t*, const std::string&);
bool PyFloat_IsNaN(PyObject* obj) {
return PyFloat_Check(obj) && std::isnan(PyFloat_AsDouble(obj));
}
bool PandasObjectIsNull(PyObject* obj) {
return obj == Py_None || obj == numpy_nan || PyFloat_IsNaN(obj) ||
(internal::PyDecimal_Check(obj) && internal::PyDecimal_ISNAN(obj));
}
} // namespace internal
} // namespace py
} // namespace arrow
+1 -1
View File
@@ -102,7 +102,7 @@ std::string PyObject_StdStringRepr(PyObject* obj);
// \brief Cast the given size to int32_t, with error checking
inline Status CastSize(Py_ssize_t size, int32_t* out,
const std::string& error_msg = "Maximum size exceeded (2GB)") {
const char* error_msg = "Maximum size exceeded (2GB)") {
// size is assumed to be positive
if (size > std::numeric_limits<int32_t>::max()) {
return Status::Invalid(error_msg);
-4
View File
@@ -33,10 +33,6 @@ from pyarrow.includes.common cimport PyObject_to_object
cimport pyarrow.includes.libarrow as libarrow
cimport cpython as cp
cdef _pandas():
import pandas as pd
return pd
arrow_init_numpy()
set_numpy_nan(np.nan)