RESSA
RESSA copied to clipboard
Stack Overflow
Currently these tests panic at 6 levels of nesting, in debug mode.
function x() {
return function() {
return function() {
return function() {
return function() {
return function() {
}
}
}
}
}
}
Especially with how modern js packaging works this is not an uncommon level of nesting.
The only way to get our tests to pass currently is to use the environment variable RUST_MIN_STACK
set to 9999999
(7 nines) or run in release mode (the moz_central
tests fail in release mode). There are 2 potential fixes for this issues
Options
- Reduce recursion
- Integrate the stacker crate to dynamically increase the stack size in a configurable way
Option 1
Technically "any recursive operation can be flattened into a while loop" but that doesn't mean it will be easy to do, this would essentially be a full re-write of this crate. It might be time to tackle this as I also believe we would see better performance with change.
Option 2
While this has the potential to be a much smaller lift from the shear size of changes, it would mostly just push the problem onto consumers. Determining reasonable default is also a bit of a problem since poorly chosen defaults would cause performance regressions and/or ergonomic issues.