I recently changed jobs and found myself in a position where I would need to do a lot of work on remote machines. Since I am Emacs user, the most common way to do this is over TRAMP. TRAMP is an Emacs package that let’s you treat a remote host like a local system, similar to VSCode Remote Development Extension. I had used TRAMP before and it tended to be slow. Since I would be using it all day now I figured I should take some time to make it faster. TRAMP really is an amazing piece of technology. It supports a huge number of protocols and it lets you pretend that you are working on a local system. You can copy files around, run programs, run shells, and for the most part everything just works. But TRAMP unfortunately has a propensity for being slow. Sometimes this is not TRAMPs fault and comes from how it is used. In my testing, each call through TRAMP takes about 50-100ms. Compare that to a normal external process call in Emacs which would take around 1 ms. Workflows that work fine on a local machine become unbearable when working remotely. However, this doesn’t mean that TRAMP has to be slow. If you run emacs -Q and use TRAMP you will normally find it quite snappy. First, let’s set up some of the basic settings. These settings below will prevent TRAMP from creating a bunch of extra files and use scp directly when moving files. (setq remote-file-name-inhibit-locks t tramp-use-scp-direct-remote-copying t remote-file-name-inhibit-auto-save-visited t) In order to open a file on a remote host, TRAMP needs to copy the file contents to your local machine. Most TRAMP methods have two ways to copy files; inline or out-of-band. Out-of-band will use external methods like rsync or scp, while inline will send compressed base64 encoded text over the SSH session and then decode it on the other side. This works best for small files where the overhead of creating a new connection is not worth it. This is by default set to 10KB. However, I found in my testing that the best value wa...
First seen: 2025-06-23 16:06
Last seen: 2025-06-24 12:11