Skip to content

Slow typing due to getPositionOffsetTransformerFromTextModel #247124

Closed

Description

I have noticed a massive slowdown while typing. I profiled, each keystroke would take 180ms to process and some showed createStateWithAppliedEdit as the problem

slow-typing-Trace-20250422T143912.json.txt.zip

Image

Activity

  1. added
    freeze-slow-crash-leak
    on Apr 22, 2025
  2. benibenj commented on Apr 22, 2025

    @benibenj
    Contributor

    I had a very quick look at this. I'm not sure what would cause this to being so slow. Johannes Rieken (@jrieken) where you typing in a very large file? Henning Dieterichs (@hediet) please check this out when you are back

  3. jrieken commented on Apr 23, 2025

    @jrieken
    ContributorAuthor

    No, I was just typing a comment in a normal file

  4. jrieken commented on Apr 23, 2025

    @jrieken
    ContributorAuthor

    Just saw this again when typing a line-comment in side src/vs/workbench/contrib/chat/browser/contrib/chatInputCompletions.ts

    Image
  5. jrieken commented on Apr 23, 2025

    @jrieken
    ContributorAuthor

    Managed to debug this. It looks like we keep calling getPositionOffsetTransformerFromTextModel (as I type) and this function creates the whole string of a text document, loops over that to break it into lines so that it can build a position-to-offset transformation. This is slow and questionable because the text document has these features natively builtin

    Image
  6. changed the title [-]Slow typing (due to `createStateWithAppliedEdit`?)[/-] [+]Slow typing due to `getPositionOffsetTransformerFromTextModel`[/+] on Apr 23, 2025
  7. added
    important
    on Apr 23, 2025
  8. added a commit that references this issue on Apr 29, 2025
  9. added
    unreleased
    on Apr 29, 2025
  10. added a commit that references this issue on Apr 29, 2025
  11. added
    insiders-released
    and removed
    unreleased
    on Apr 30, 2025
  12. locked and limited conversation to collaborators on Jun 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

freeze-slow-crash-leakimportantinline-completionsinsiders-released

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions