Skip to content

Commit 1e4ab69

Browse files
committed
Update opt-trace-format.md
1 parent f67efd5 commit 1e4ab69

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎v3/docs/opt-trace-format.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,3 +797,19 @@ foo(1)
797797
[TODO: talk about appending `_z` onto `unique_hash` when the frame becomes a zombie.]
798798

799799
[TODO: IMPROVE ME!]
800+
801+
802+
# Notes: Potential optimizations
803+
804+
The default trace format is completely unoptimized. It's designed so as to be "memoryless" -- i.e., a frontend can render an execution state by simply reading that entry and not any of its neighbors.
805+
806+
However, the `stdout` field can often take up A LOT OF SPACE since it's "cumulative" -- i.e., at each step, `stdout` represents the entire contents of the `stdout` buffer, not simply what's been printed out in the current step. Thus, it suffers from N^2 space explosions. Even a simple program like this one prints out an ENORMOUS amount to stdout:
807+
808+
```python
809+
choices = ['pizza', 'pasta', 'salad', 'nachos']
810+
for i in enumerate(choices):
811+
print choices # if you comment this out, the trace is much smaller
812+
choices.append(i)
813+
```
814+
815+
Thus, this is one target for optimization if deemed necessary down the line. However, I'm hesitant to optimize the trace since it makes trace-handling code in the frontend and backend more complicated :/

0 commit comments

Comments
 (0)