You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OPTIMIZATION #2: Direct Python C API for numeric types
Problem:
- All numeric conversions used pybind11 wrappers with overhead:
* Type detection, wrapper object creation, bounds checking
* ~20-40 CPU cycles overhead per cell
Solution:
- Use direct Python C API calls:
* PyLong_FromLong/PyLong_FromLongLong for integers
* PyFloat_FromDouble for floats
* PyBool_FromLong for booleans
* PyList_SET_ITEM macro (no bounds check - list pre-sized)
Changes:
- SQL_INTEGER, SQL_SMALLINT, SQL_BIGINT, SQL_TINYINT → PyLong_*
- SQL_BIT → PyBool_FromLong
- SQL_REAL, SQL_DOUBLE, SQL_FLOAT → PyFloat_FromDouble
- Added explicit NULL handling for each type
Impact:
- Eliminates pybind11 wrapper overhead for simple numeric types
- Direct array access via PyList_SET_ITEM macro
- Affects 7 common numeric SQL types
0 commit comments