Skip to content

Feature Request: Zero-latency Typing #27378

Open

Description

@aniljava

Following articles goes into length describing the issue in general.

The subtle typing lag is observed in VS Code in same machine in which the typing is lag free with sublime text and even eclipse. This feature request is to look into the issue and address it if feasible.

Activity

  1. added
    feature-request
    editor-core
    on Jun 1, 2017
  2. Chillee commented on Jun 23, 2017

    @Chillee

    I performed the tests listed at "Typing with pleasure" on my own computer, and these are my results:

  3. mauro3 commented on Aug 9, 2017

    @mauro3

    I just ran some typometer tests as well, here the results (note the SD column is the standard deviation):
    github-27378

    Here some interesting plots, comparing VSCode behavior of synchronous setup (a new key is only pressed once the last is displayed):
    github-27378-sync

    and asynchronous
    github-27378-async

    Also note that some extensions can increase typing latency considerably: SebastianZaha/vscode-emacs-friendly#20

    Edit: this is on a Linux system with xmonad window manager.

    Edit edit: If you get typometer timing out with "cannot detect char" at some point. Then, to fix, zoom in a lot. Also, you need at least one other line which is wider than the screen to make it work. Also, it's recommended to use a non-block cursor but I didn't see any difference there.

  4. codecat commented on Aug 10, 2017

    @codecat

    Yesterday I tried switching from Sublime to VSCode, but sadly am returning to Sublime again today because of this issue. Would love to see this fixed in VSCode.

  5. amritk commented on Aug 10, 2017

    @amritk

    Melissa (@codecat) I was in the same boat as you, but VScode has so much else going for it I switched back again from sublime even with the lag.

  6. SebastianZaha commented on Aug 11, 2017

    @SebastianZaha
    Contributor

    In the case of the emacs extension, the old one had some code that was registering the "type" command to implement some more complex keybinding systems.

    I have removed it and I think the latency overhead is fixed. (in v0.8.0 of https://marketplace.visualstudio.com/items?itemName=lfs.vscode-emacs-friendly)

    The typing latency is quite spiky though, even with no extensions, at least when trying to graph it with the aforementioned program.

  7. codecat commented on Aug 11, 2017

    @codecat

    Yes, I notice the input lag without any extensions installed.

  8. ziriax commented on Sep 8, 2017

    @ziriax

    Not only am I experiencing input lag, but lately I also have to press the cut/copy/paste keys rather long, otherwise nothing is copied to the clipboard. Not sure if this is related, but it is extremely annoying. Although of course every good programmer never copy/pastes ;-)

  9. richardgirges commented on Nov 28, 2017

    @richardgirges

    Not only am I experiencing input lag, but lately I also have to press the cut/copy/paste keys rather long, otherwise nothing is copied to the clipboard. Not sure if this is related, but it is extremely annoying. Although of course every good programmer never copy/pastes ;-)

    I'm experiencing this exact same issue. For instance, I have to explicitly hold down the command key on my mac, and then press C afterwards in order to copy. If I do it too fast, nothing gets copied. In some cases, the C key is registered before the command key and the VSCode will end up typing the letter C into the editor. I don't see this behavior anywhere else other than VSCode :(

  10. chmln commented on Dec 22, 2017

    @chmln

    For someone with >100 wpm, the input latency is unbearable and no amount of features can compensate for this. It is a text editor after all.

    If the behemoth of IntelliJ IDEA could do zero latency, so can VSCode. Its great to see work done on the performance front, and hope this is just the beginning. 👍

  11. pcgeek86 commented on Dec 31, 2017

    @pcgeek86

    I'm experiencing typing lag on a Dell XPS 9350 running Windows 10 1709 (Fall Creators Update). It doesn't seem apparent in other applications, like Firefox and Chrome, but is quite noticeable in Visual Studio Code. I've noticed the typing lag while editing a JavaScript file in particular.

  12. 46 remaining items

  13. basaran commented on Oct 21, 2022

    @basaran

    Hello,

    I see you said Sublime font rendering was great above, do you know why at the pixel level? How does it compare with VS Code's terminal rendering?

    Sublime allows you to use the older GDI which in my opinion provides better looking (not as fuzzy but hinted enough) font rendering. That also depends on the font too. If you are on a < 140ppi display, and have 20/20 fuzziness would not be as visible of course. But sublime and VS code open side by side, on the same font, at the same size, you could still tell which one looks sharper.

    // Windows-only options:
    "directwrite": (default) Use DirectWrite for font rendering 
    "gdi": Use GDI for font rendering
    "dwrite_cleartype_classic": Only applicable to "directwrite" mode, should render fonts similar to traditional GDI
    "dwrite_cleartype_natural": Only applicable to "directwrite" mode, should render fonts similar to ClearType "natural quality" GDI
    "subpixel_antialias": Force ClearType antialiasing when disabled at system level
    

    Well there's nothing really that can improve that provided we've done a good job with either VS Code's remote connection in a remote Window. There will always be some overhead in communicating with some other machine.

    True, but I was referring to the OS latency in general when WSL is enabled. Perhap things are different now as I haven't been on a windows desktop lately. If you have the time, I suggest you try your measurements on a desktop that never had WSL enabled and see how the keyboard responds. Please also see my comment about the CPU power saving settings in the bios.

    In addition to disabling the CPU power saving from the BIOS, you could also experiment with disabling the USB suspend settings. I am not sure if it is possible to do on windows, but on Linux adding "usbcore.autosuspend=-1 pcie_aspm=off" made a difference. You could probably do it through udev as well.

    I am on the laptop now which is 212 ppi so the camera doesn't capture the pixels as clearly, but I will take pictures of the Hack Mono when I get back to the cave. What size did you set the Hack Mono font and please let me know your screen resolution as well? I can take pictures on 1440p "23.6 and, 1080p 15.6".

  14. basaran commented on Oct 21, 2022

    @basaran

    Hello, It appears on Linux, vscode (electron) and sublime follow the same fontconfig (since there is no gdi, direct_write), I am not able to provide the screenshots at the moment.

  15. basaran commented on Oct 21, 2022

    @basaran

    Hello, It appears on Linux, vscode (electron) and sublime follow the same fontconfig (since there is no gdi, direct_write), I am not able to provide the screenshots at the moment. They both look the same way on Linux as it is configured.

  16. Tyriar commented on Oct 24, 2022

    @Tyriar
    Contributor

    basaran thanks for the info, this is helpful!

    True, but I was referring to the OS latency in general when WSL is enabled.

    That would be surprising, perhaps it's a side effect of early WSL1 as it was more integrated into Windows? WSL2 is essentially a lightweight Hyper-V VM as I understand it.

    you could also experiment with disabling the USB suspend settings.

    Isn't USB suspend just a power savings thing that only has impact if you're away from your computer for a while?

    What size did you set the Hack Mono font and please let me know your screen resolution

    Can't remember exactly, I think it may have been ~14px on VS Code and the default in Sublime, not sure which monitor I took those on 😅

  17. basaran commented on Oct 24, 2022

    @basaran

    That would be surprising, perhaps it's a side effect of early WSL1 as it was more integrated into Windows? WSL2 is essentially a lightweight Hyper-V VM as I understand it.

    I was on windows 10 with WSL2. Perhaps it was just a side effect of enabling the hyper-v services, perhaps it was specific to my AMD configuration. Who knows :)

    Isn't USB suspend just a power savings thing that only has impact if you're away from your computer for a while?

    It sure is, and should not interfere but there are quite a few posts on the forums about it too. For some people lag becomes more noticeable after a sleep-wakeup cycle. In addition to these factors, there is also the matter of the USB port you use. Some USB ports are shared across different devices, and when you have a highly active wifi connection for instance, things would start to lag as well.

    Good luck and looking forward to testing the new and improved vs code.

  18. Balfa commented on Nov 24, 2022

    @Balfa

    anil (@aniljava) now that #161622 is merged, you might consider testing and closing this issue if it meets your intent.

  19. removed their assignment
    on Dec 13, 2022
  20. dmohs commented on Jan 4, 2023

    @dmohs

    This is now, as far as I am concerned, fixed. I just tested VSCode Nightly with "Is it Snappy?" I'm running a late 2013 Mac Pro with a 240Hz display. VSCode (32.9ms from key press to display) compares favorably with MacVim (37.5ms).

    I just want to express my gratitude to Daniel Imms (@Tyriar) for their work on this. I am sensitive to latency, and for this reason I have had to simply observe from afar my colleagues usage of VSCode and some of it's fantastic features. Now I get to join in on the fun. Thank you so much for giving me access to this tool.

  21. Tyriar commented on Jan 4, 2023

    @Tyriar
    Contributor

    David Mohs (@dmohs) good to hear it's improved! Still, this should be an ongoing effort. 32.9ms is still pretty bad imo 🙁, I don't blame you for being sensitive if it was even higher than that.

  22. avdhoot commented on Aug 18, 2023

    @avdhoot
  23. basaran commented on Aug 19, 2023

    @basaran

    Here is another update. I am still on Arch and a few weeks ago, I discovered something else. In my setup, in addition to the c-states, disabling virtualization extensions also reduced the input lag and standard deviation on Linux. The new intel processors have dynamic cpu scaling, so disabling performance saver from the bios may not have much effect. I would suggest disabling the dynamic scaling, and switching to usermode and set a fixed frequency.

    # enable userspace power governow
    # sudo sh -c "echo passive > /sys/devices/system/cpu/intel_pstate/status"
    
    # set freq
    sudo sh -c "cpupower frequency-set --governor userspace"
    sudo sh -c "cpupower frequency-set --freq 2.4GHz"
    
  24. Tyriar commented on Jul 8, 2024

    @Tyriar
    Contributor

    We'll be starting the effort to build a webgpu-based renderer in the editor this iteration. You can read about the prototype and follow along in #221145

  25. spajus commented on Mar 8, 2026

    @spajus

    Any updates on this? It got progressively worse with all the copilot enhancements and updates.

  26. reinux commented on Mar 8, 2026

    @reinux

    Yes, even with the features turned off.

  27. dougg0k commented on Mar 8, 2026

    @dougg0k

    While they dont add the feature, which in imo should be even more prioritized than the GPU based renderer. I dont suppose it should require GPU to have it.

    This may help. https://gist.github.com/dougg0k/2c50ef89aec97f779135dc0f7f2c1c9f

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

    editor-corefeature-request

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions