NeuroCalc is a high-performance C++ extension library designed to accelerate common mathematical operations used in neural network computations. By offloading vectorized math to native C++, we bypass the Python Global Interpreter Lock (GIL) and overhead.
- Vectorized Hypotenuse: Optimized Euclidean distance calculation using
-O3compiler flags. - Dot Product Kernel: High-speed floating-point multiplication and summation.
- Memory Optimization: Uses
std::vector::reserveto minimize reallocations during runtime.
We tested NeuroCalc against standard Python list comprehensions with 100,000 elements:
| Operation | Python Time | C++ Time | Speedup |
|---|---|---|---|
| Hypotenuse | 1.53s | 0.53s | ~2.8x |
| Dot Product | 0.12s | 0.08s | ~1.5x |
NeuroCalc uses scikit-build-core for a seamless C++ build experience within Python.