microsoft / microsoft/terminal
[Performance] Replace std::vector with more lightweight structure in `RenderData::GetPatternId`
- Dominant language
- C++
- Stars
- 105k
- Forks
- 9.6k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 29
Description
This is about the scrolling test in #10563. A simplified repro would be:
```bash
time bash -c 'yes | head -n1000000'
```
which takes 7-8s with windows terminal and 300ms with gnome terminal.
Test case provided by @lhecker.
These lines show up in the hot paths of the trace of `OpenConsole`:
https://github.com/microsoft/terminal/blob/main/src/renderer/base/renderer.cpp#L788

It appears that simply constructing empty `std::vector` (empty because this is in conhost/OpenConsole) is quite expensive.
CC @PankajBhojwani
Contributor guide
Research direction
Start with RenderData::GetPatternId and the referenced hot path at src/renderer/base/renderer.cpp#L788. Run the provided scrolling repro, `time bash -c 'yes | head -n1000000'`, and inspect the trace showing empty std::vector construction in conhost/OpenConsole. Done means replacing that costly structure appropriately and confirming the scrolling performance improves.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- performance
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100