From d9371c2f6f1293b44defcff95cad91c37dea65d1 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 3 Mar 2023 22:53:48 +0300 Subject: fix(tvix/eval): don't print full stack in observer Print only the top 6 values of the stack, not the entire stack. There's very few operations that deal with more values anyways, so the rest are not likely to be useful. This gets us one step closer to tracing VERY large executions without blowing up. Change-Id: I97472321b0321b25d534d9f53b3aadfacc2318fa Reviewed-on: https://cl.tvl.fyi/c/depot/+/8201 Tested-by: BuildkiteCI Reviewed-by: raitobezarius --- tvix/eval/src/observer.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tvix/eval/src') diff --git a/tvix/eval/src/observer.rs b/tvix/eval/src/observer.rs index 970a644a3d43..29e4fb2d9c06 100644 --- a/tvix/eval/src/observer.rs +++ b/tvix/eval/src/observer.rs @@ -166,7 +166,14 @@ impl TracingObserver { fn write_stack(&mut self, stack: &[Value]) { let _ = write!(&mut self.writer, "[ "); - for val in stack { + // Print out a maximum of 6 values from the top of the stack, + // before abbreviating it to `...`. + for (i, val) in stack.iter().rev().enumerate() { + if i == 6 { + let _ = write!(&mut self.writer, "..."); + break; + } + self.write_value(&val); } -- cgit 1.4.1