Commit cb505de
committed
Convert SA-IS suffix array construction from recursive to iterative
The recursive sais() function caused a stack overflow (0xc00000fd) on
Windows native CI due to the default 1MB stack limit. The recursive
calls accumulate stack frames with closures and local variables that
exceed this limit for larger inputs.
Replace with an iterative implementation using an explicit frame stack:
- Descent phase computes reduced problems, saving state in heap-allocated
SaisFrame structs instead of on the call stack
- Ascent phase propagates solutions back through saved frames
- Extract sais_final_sort() helper for the shared induced-sort logic1 parent 2d3823a commit cb505de
1 file changed
Lines changed: 268 additions & 177 deletions
0 commit comments