interactive
interactive copied to clipboard
Excess re-rendering causes waiting times after cell completion
Describe the bug
for (var i = 0; i <= 100; i++) System.Console.WriteLine(i);
It is expected that such a small number of console writes would complete instantly. Indeed it does, however, excess re-rendering takes place immediately afterwards, costing additional seconds. This waiting time grows with the number of console writes, which is undesirable especially when used inside a loop.
It seems that a render function is called every time console output changes. It would probably be a lot faster if it buffered the output and just rendered it when the end of the cell is reached.
Please complete the following:
Which version of .NET Interactive are you using? (In a notebook, run the #!about
magic command. ):
- OS
- [ ] Windows 11
- [x] Windows 10
- [ ] macOS
- [ ] Linux (Please specify distro)
- [ ] iOS
- [ ] Android
- Frontend
- [ ] Jupyter Notebook
- [ ] Jupyter Lab
- [ ] nteract
- [x] Visual Studio Code
- [ ] Visual Studio Code Insiders
- [ ] Visual Studio
- [ ] Other (please specify)
This is the .dib file equivalent to https://github.com/dotnet/interactive/issues/1832. This issue has been fixed months ago, but the issue still persists.
For the solution of buffering output and only rendering at the end, it would probably need to be an opt-in feature to avoid breaking code that may rely on having output written before the cell is done:
printfn "Beginning long computation"
let result = longComputation()
printfn "Done"
Maybe a magic command would be a good way to say that you want a specific cell to only render once at the end?
This bug isn't related to the file format. The root cause is different from #1832. This appears to be due to a change in VS Code rendering but we haven't pinned it down yet.
@brettfo