implement lazy initialization strategy for scenarios#2792
implement lazy initialization strategy for scenarios#2792
Conversation
sriv
commented
Oct 28, 2025
- make scenarios initialize lazily for table driven scenarios
- add benchmark tests for lazy scenario initialization
addresses a concern in #2790 for memory footprint Signed-off-by: sriv-e6x <srikanth.venugopalan@e6x.io>
Signed-off-by: sriv-e6x <srikanth.venugopalan@e6x.io>
Lazy vs Eager Scenario Initialization - Quick Benchmark ComparisonSummaryLazy mode is 100-4000x faster and uses 99.9% less memory during scenario creation. Quick Comparison TableScenario Creation (1000 rows × 2 columns)
Nested Tables (10 spec × 100 scenario = 1000 total iterations)
Performance HighlightsCreation Speed ComparisonKey Insight: Lazy time is constant (~61ns) regardless of table size! Memory Usage ComparisonKey Insight: Lazy uses constant 120 bytes regardless of table size! Trade-offsIteration Performance (100 scenarios)
Analysis: Lazy pays a small cost during iteration (141 ns extra per scenario), but this is negligible compared to actual test execution time. Benchmark Environment
Run Benchmarks Yourself# Quick comparison
go test -bench=. -benchmem ./parser | grep Benchmark
# Detailed results with 3-second runs
go test -bench=. -benchmem -benchtime=3s ./parser
# Memory-focused benchmarks
go test -bench=BenchmarkMemory -benchmem ./parser |
Benchmark Results
Notes
See Workflow log for more details. |
Signed-off-by: sriv-e6x <srikanth.venugopalan@e6x.io>
Signed-off-by: sriv-e6x <srikanth.venugopalan@e6x.io>
|
@jensakejohansson - thanks for checking this out. I had missed one path with nested tables. I have pushed another commit - think this should address the issue. If you can take another look, that'd be super helpful! |
|
@sriv I don't know if I'm confused here, but I don't see any new commits? |
|
no, that's my bad - I didn't push it before, now It should be in - apologies |
|
Still issues here. Now when I execute my test spec with nested tables the execution freezes, both when execution in VSC and terminal. Same place very time... Code_61Mx8YQtqB.mp4 |