The combinatorial_codes package includes optional C extensions that provide significant performance improvements for computationally intensive operations. These extensions are automatically compiled during package installation.
When you install the package using pip install, you'll see explicit feedback about C extension compilation:
pip install -e .During installation, you'll see messages like:
============================================================
Building combinatorial_codes C extensions...
============================================================
✓ SUCCESS: C extensions compiled successfully!
Performance-optimized functions are now available.
Expected speedup: 5-10x for computationally intensive operations.
============================================================
After installation, you can easily check if C extensions are working:
import combinatorial_codes as cc
print(cc.quick_status())
# Output: "C extensions: ACTIVE (High Performance)"import combinatorial_codes as cc
cc.check_c_extension_status()This will show:
==================================================
COMBINATORIAL CODES - EXTENSION STATUS
==================================================
✓ C extensions: ACTIVE
✓ Performance mode: HIGH
✓ Available functions: 6
✓ Expected speedup: 5-10x for large computations
==================================================
python test_c_extension.pyThis runs a complete test of both C extension availability and core functionality.
The C extensions will be automatically compiled if:
- A C compiler is available on your system
- NumPy development headers are accessible
- Python development headers are available
If the C extensions fail to compile, you'll see a warning message during installation:
⚠ WARNING: C extension compilation failed: [error details]
The package will still work using Python/Numba implementations.
Performance will be slower but functionality remains intact.
The package will still work using Python/Numba implementations.
- Requires Xcode command line tools:
xcode-select --install - Works with both Intel and Apple Silicon
- Requires
gccor compatible C compiler - Install development packages:
sudo apt-get install python3-dev(Ubuntu/Debian)
- Requires Microsoft Visual C++ Build Tools
- Or use conda which typically includes necessary compilers
The C extensions provide significant speedups for:
intersections_inside_a_clique: ~5-10x fasterintersection_of_codewords_from_bits: ~3-5x fasterlattice_sliceoperations: ~2-3x faster
For large combinatorial codes with many maximal words, these performance improvements can reduce computation time from hours to minutes.