doublingStringBindExpr doubles the input string s through nested cel.bind calls: cel.bind(a0, s, cel.bind(a1, a0 + a0, ... cel.bind(aN, aN-1 + aN-1, aN == aN))) Unlike list concatenation, string concatenation materializes a new backing string at each level, so the physical allocation doubles alon
(levels int)
| 431 | // Unlike list concatenation, string concatenation materializes a new backing string at each |
| 432 | // level, so the physical allocation doubles alongside the logical size. |
| 433 | func doublingStringBindExpr(levels int) string { |
| 434 | expr := fmt.Sprintf("a%d == a%d", levels, levels) |
| 435 | for i := levels; i >= 1; i-- { |
| 436 | expr = fmt.Sprintf("cel.bind(a%d, a%d + a%d, %s)", i, i-1, i-1, expr) |
| 437 | } |
| 438 | return fmt.Sprintf("cel.bind(a0, s, %s)", expr) |
| 439 | } |
| 440 | |
| 441 | func TestBindingsMemoryLimitStringConcat(t *testing.T) { |
| 442 | // A 1MiB input string doubled per bind level. The doublings rapidly exceed the 1M unit |
no outgoing calls
no test coverage detected