Skip to content

Extremely slow performance when processing virtual terminal sequencesΒ #10462

Open

Description

Windows Terminal version (or Windows build number)

1.8.1521.0

Other Software

No response

Steps to reproduce

Using any command line utility that produces virtual terminal sequences for setting the colors of individual characters, the performance of the terminal drops by a factor of around 40.

To measure this effect precisely, you can use the F2 key in termbench and observe the performance difference between color-per-character output and single-color output:

https://github.com/cmuratori/termbench/releases/tag/V1

Expected Behavior

Despite the increased parsing load, modern CPUs should not have a problem parsing per-character color escape codes quickly. I would expect the performance of the terminal to be able to sustain roughly the same frame rate with per-character color codes as without, and if there was a performance drop, I wouldn't expect it to be anything close to 40x.

Actual Behavior

The speed of per-character color output is 40x slower than the speed of single-color output.

Activity

  1. ghost added
    Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting
    on Jun 19, 2021
  2. ghost added
    Needs-Tag-FixDoesn't match tag requirements
    on Jun 19, 2021
  3. CoreyDotCom commented on Jun 19, 2021

    @CoreyDotCom
    Author

    Note that this is a clone of #10362 which was closed by original submitter. As the original bug report was valid it should have been remained open, especially after quite a few suggestions were provided as to how to improve matters. Feel free to reopen original tracking issue and close this duplicate if appropriate. Thank you for the work that you guys do on this project.

  4. changed the title [-]https://github.com/microsoft/terminal/issues/10362[/-] [+]Extremely slow performance when processing virtual terminal sequences[/+] on Jun 19, 2021
  5. DHowett commented on Jun 19, 2021

    @DHowett
    Member

    Thanks for re-opening this! It’s definitely valuable for us to be tracking it, and the ideas suggested in the original thread are good ones that are worth considering. We also have #10461 tracking specific requests from #10362.

  6. lhecker commented on Jun 19, 2021

    @lhecker
    Member

    Personally I'd like to also welcome Casey Muratori (@cmuratori) and MārtiΕ†Ε‘ MoΕΎeiko (@mmozeiko) back to give any comments if they wish to do so. Of course it'd be entirely understandable if they don't. I believe I can speak for the terminal team, when I say that we want to keep the door to our community open and welcome any civil discourse.


    I see the comment regarding slow VT parsing again, but I hope you consider that performance of OpenConsole (aka future conhost) has already improved about 4-5x in the last year. With upcoming conhost versions, or the current OpenConsole, you can expect to see a throughput improvement from 4MB/s to about 16-20MB/s for termbench. I know this isn't 270MB/s, but it's a significant improvement regardless, despite keeping all the backwards-compatibility, etc.

    For instance - referring to the mentioned offenders:

    We're now working on improving _SetGraphicsRenditionRGBColor in #10426, which will improve performance for termbench by another 20-25%. FYI: Chester Liu (@skyline75489) is working on this entirely in their spare time! (...and the PR is in fact not finished yet. It'll likely feature more improvements once it's done.)

    Here's a flamegraph of OpenConsole for termbench:
    openconsole_termbench_flamegraph

    The render output thread is highlighted in blue. _SetGraphicsRenditionRGBColor is being hovered.

    If you have concrete ideas what to improve (and optionally how) to speed up OpenConsole's VT performance further, please let us know and we'll get to it. Promise! Contributions are especially welcome at any time!

  7. mmozeiko commented on Jun 19, 2021

    @mmozeiko

    Is there a possibility we (outside of Microsoft) can get some documentation or specification on console driver interface -\\Device\\ConDrv\\Server, structures in condrv.h and conmsgl*.h files ?

  8. DHowett commented on Jun 19, 2021

    @DHowett
    Member

    Fair question! We should definitely have some docs on the driver interface, since we're now an open source project that is using an underdocumented OS fixture...

    Right now the best we have is in the ApiDispatcher and some of the "load bearing code" comments across the codebase. That's not great. I'll see what we can do about that!

  9. lhecker commented on Jun 19, 2021

    @lhecker
    Member

    MārtiΕ†Ε‘ MoΕΎeiko (@mmozeiko) Sure! Let's continue that discussion here: #10463

  10. skyline75489 commented on Jun 26, 2021

    @skyline75489
  11. skyline75489 commented on Jun 26, 2021

    @skyline75489
  12. mmozeiko commented on Jun 26, 2021

    @mmozeiko
  13. skyline75489 commented on Jun 26, 2021

    @skyline75489
  14. 45 remaining items

  15. DHowett commented on Nov 2, 2021

    @DHowett
    Member

    (Or, I don't really know how to use this messaging board, the comment is there, and I just don't see it.)

    Ah, I minimized the comments above before I locked the thread. They can be expanded with the "Show comment" link at the righthand side for now, but I'll also go through and unminimize some of them. Sorry!

    "...never be afraid of cannibalizing yourself..."

    I like that. You're right, of course. These are all really good points for us to think about. πŸ˜„

  16. plasticalligator commented on Jan 7, 2024

    @plasticalligator
  17. christianparpart commented on Jan 7, 2024

    @christianparpart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-PerformancePerformance-related issueImpact-CorrectnessIt be wrong.Issue-BugIt either shouldn't be doing this or needs an investigation.Priority-1A description (P1)Product-ConptyFor console issues specifically related to conptyProduct-MetaThe product is the management of the products.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions