Documentation Index
Fetch the complete documentation index at: https://mintlify.com/shedskin/shedskin/llms.txt
Use this file to discover all available pages before exploring further.
General Questions
What is Shed Skin?
What is Shed Skin?
Is Shed Skin production-ready?
Is Shed Skin production-ready?
- Performance-critical code sections (hundreds to thousands of lines)
- Computational algorithms independent of external libraries
- Projects where you can refactor code to fit Shed Skin’s constraints
What license is Shed Skin under?
What license is Shed Skin under?
Capabilities
What kind of speedup can I expect?
What kind of speedup can I expect?
- Range: 1-100x faster than CPython 3.14
- Average: 20x speedup
- Median: 12x speedup
- Code characteristics (computation vs. memory allocation heavy)
- Compilation flags (
--nobounds,--nowrap, optimization levels) - Algorithm complexity and data structures used
Can Shed Skin compile any Python code?
Can Shed Skin compile any Python code?
- Static typing: Variables must have a single, consistent type
- Limited standard library: Only about 30 modules supported
- No dynamic features: No
eval,getattr,isinstance, etc. - Size limits: Best for programs under several thousand lines
- Feature restrictions: No nested functions, no
*args/**kwargs, no multiple inheritance
Can I use Shed Skin with existing Python projects?
Can I use Shed Skin with existing Python projects?
- Identify performance bottlenecks in your code
- Extract them into separate modules
- Refactor these modules to be Shed Skin compatible
- Compile them as extension modules
- Import and use them in your main Python program
Does Shed Skin support Python 3?
Does Shed Skin support Python 3?
Comparisons
How does Shed Skin compare to PyPy?
How does Shed Skin compare to PyPy?
- ✅ Supports full Python language and libraries
- ✅ No code changes required
- ❌ Slower startup time
- ❌ Typically slower than Shed Skin for computational code
- ❌ Requires using PyPy interpreter
- ✅ Better performance for compatible code
- ✅ Generates native binaries or CPython extensions
- ✅ Works with standard CPython
- ❌ Requires code to fit restricted subset
- ❌ Limited library support
- ❌ May require significant refactoring
How does Shed Skin compare to Cython?
How does Shed Skin compare to Cython?
- ✅ Supports full Python language
- ✅ Gradual optimization (add types as needed)
- ✅ Excellent library support including NumPy
- ❌ Requires manual type annotations for best performance
- ❌ More verbose code
- ✅ No type annotations needed (automatic inference)
- ✅ Often better performance than non-annotated Cython
- ✅ Cleaner code (pure Python)
- ❌ More restrictive subset
- ❌ Limited library support
How does Shed Skin compare to Numba?
How does Shed Skin compare to Numba?
- ✅ Excellent for NumPy-style array operations
- ✅ Minimal code changes (decorator-based)
- ✅ Supports GPU acceleration
- ❌ Limited to numerical/array code
- ❌ Slower for non-numerical code
- ❌ Requires Numba runtime
- ✅ Good for general algorithms and data structures
- ✅ Standalone binaries (no runtime)
- ✅ Comparable or better performance for non-array code
- ❌ No NumPy/GPU support
- ❌ Requires full compilation step
How does Shed Skin compare to Nuitka?
How does Shed Skin compare to Nuitka?
- ✅ Supports complete Python language
- ✅ All standard library modules
- ✅ Compatible with all Python packages
- ❌ Moderate speedups (typically 2-4x)
- ✅ Significant speedups (typically 10-20x+)
- ❌ Restricted Python subset
- ❌ Limited library support
Use Cases
When should I use Shed Skin?
When should I use Shed Skin?
- ✅ You have 100-5000 lines of computation-heavy code
- ✅ Performance is critical (need 10-100x speedup)
- ✅ Code can be isolated from external dependencies
- ✅ You’re willing to refactor for compatibility
- ✅ Your code uses basic Python features and data structures
- ✅ You want to stay with pure Python syntax (no annotations)
When should I NOT use Shed Skin?
When should I NOT use Shed Skin?
- ❌ Code heavily uses unsupported libraries (pandas, requests, etc.)
- ❌ Program is very large (>5000 lines)
- ❌ You need dynamic Python features (eval, reflection, etc.)
- ❌ Code uses many unsupported Python features
- ❌ Performance is already acceptable
- ❌ You can’t refactor existing code
Can I use Shed Skin for web applications?
Can I use Shed Skin for web applications?
- Compile computational components as extension modules
- Import them into your web application
- Use them for performance-critical endpoints
Can I use Shed Skin for data science?
Can I use Shed Skin for data science?
- Use Shed Skin for custom algorithms
- Pass data between NumPy/pandas and Shed Skin using
.tolist()conversion - Compile performance bottlenecks as extension modules
Technical Questions
How does type inference work?
How does type inference work?
- Constraint generation: Analyzes operations to determine type constraints
- Iterative analysis: Propagates type information through the program
- Type resolution: Determines concrete types that satisfy all constraints
What C++ compiler is required?
What C++ compiler is required?
- Linux/macOS: g++ (GCC) or clang++
- Windows: Microsoft Visual C++ (via Visual Studio Build Tools)
Why does Shed Skin use the Boehm GC?
Why does Shed Skin use the Boehm GC?
- Automatic memory management (like Python)
- Conservative garbage collection
- Thread-safe operation
- Good performance for C++ programs
Can I disable garbage collection?
Can I disable garbage collection?
--nogc flag:How are integers and floats handled?
How are integers and floats handled?
- Integers: 32-bit signed (
int32) on most platforms - Floats: 64-bit double precision (
float64)
What about Unicode support?
What about Unicode support?
- Only 1-byte characters are fully supported
- UTF-8 multi-byte characters may not work correctly
- ASCII text works fine
Extension Modules
How do extension modules work with CPython?
How do extension modules work with CPython?
- Shed Skin compiles your Python code to C++
- The C++ code is compiled with Python C API bindings
- The resulting module can be imported like any Python module
- Data is converted between Python and C++ representations on call boundaries
What types can be passed to/from extension modules?
What types can be passed to/from extension modules?
- Scalars:
int,float,complex,bool,str,bytes,bytearray - Containers:
list,tuple,dict,set - Special:
None, instances of user-defined classes
- Functions/lambdas
- Iterators/generators
- Most standard library objects
Can multiple extension modules interact?
Can multiple extension modules interact?
Development
How can I debug compiled code?
How can I debug compiled code?
- Test in CPython first: Run with
python myprogram.pyto catch logic errors - Use assertions: They’re compiled unless you use
--noassert - Enable bounds checking: Don’t use
--noboundsduring development - Use debug builds: Default
Debugbuild type includes debugging symbols - Use GDB/LLDB: Debug the compiled binary like any C++ program
- Print debugging: Good old
print()statements work
How can I contribute to Shed Skin?
How can I contribute to Shed Skin?
- How to set up the development environment
- Testing procedures
- Code contribution guidelines
- Adding library module support
- Documentation improvements
Where can I get help?
Where can I get help?
- Documentation: Shed Skin Docs
- GitHub Issues: Report bugs or ask questions
- Examples: 80+ example programs
- Source Code: Study the compiler internals on GitHub
Performance
Why is my compiled code slower than expected?
Why is my compiled code slower than expected?
- Memory allocations: Creating many small objects (lists, tuples, class instances)
- Bounds checking: Enabled by default, use
--noboundsafter testing - Suboptimal algorithm: Shed Skin doesn’t change your algorithm
- Mixed int/float operations: Can add conversion overhead
- Extension module overhead: Conversion of builtin types on each call
What optimization flags should I use?
What optimization flags should I use?
--nobounds: Disable array bounds checking (test first!)--nowrap: Disable wrap-around checking for negative indices--int64: Use if you need large integers--nogc: Only for short programs (causes memory leaks)
FLAGS file for advanced optimization.Can I use Shed Skin for parallel/concurrent code?
Can I use Shed Skin for parallel/concurrent code?
- Compile extension modules and use Python’s
multiprocessing - Use OpenMP in manually written C++ code integrated with Shed Skin
- Run multiple processes of the compiled binary