
iTerm2 has a new drawing engine that uses Metal 2 - CharlesW
https://gitlab.com/gnachman/iterm2/wikis/Metal-Renderer
======
evmar
I fiddle in this area as a hobby project. One thing I never understand when I
read announcements like this is why the graphics performance affects the
throughput. Like in a video game, the world moves at the same rate regardless
of the frame rate, so why are the two related here?

In some of my experimental terminal emulators I've decoupled these and it's
not so hard -- there's a piece that processes command output as fast as it
can, and then there's another piece that updates the screen as fast as it can,
and as long as those two pieces are decoupled then even if your graphics
hardware is 5fps it's still fast to cat a file.

~~~
gnachman
It's a funny feeling opening hacker news and seeing your project at the top :)

In iTerm2's case it's because of bad decisions about a decade ago. The data
model is read & written on the main thread. The main thread is solely
responsible for drawing operations if you use the standard drawRect: interface
on NSView. That means that a slow draw blocks it from processing more data.
Other work, like reading from the socket and parsing bytes into tokens was
offloaded onto other threads years ago. Unwinding all the assumptions about
single-threadedness is nearly impossible. The only way to reduce the main
thread's workload is to use a GPU renderer because building the data
structures the GPU needs can be done off the main thread after a quick copy of
the necessary state.

~~~
natvert
Yes, thank you! Perhaps this has been asked before, but is there any hope of
an Ubuntu port?

~~~
gnachman
Only if openstep catches up with Apple, or I retire. I wouldn’t hold my
breath.

~~~
natvert
Haha, ok. Thank you again for all your hard work! Iterm2 is 90% the reason I
pay a premium for a Mac. I would gladly skip paying the apple tax and put the
funds toward iterm2 on other platforms if it ever becomes available :)

------
dev_dull
After trying out alacritty[1] and seeing just _how good_ gpu-accelerated
terminal could be I’ve been eagerly awaiting an update like this from iterm.

I really wish iterm was cross platform. I’ve realized when switching between
Mac and Linux how important the terminal is to my development and quality of
life.

1\. [https://github.com/jwilm/alacritty](https://github.com/jwilm/alacritty)

~~~
davrot
I would recommend kitty[1] as well, it certainly has more features than
alacritty, like opening links via keyboard using hints.

1\. [https://github.com/kovidgoyal/kitty](https://github.com/kovidgoyal/kitty)

~~~
lima
Just had a look at their docs:

[https://sw.kovidgoyal.net/kitty/remote-
control.html](https://sw.kovidgoyal.net/kitty/remote-control.html)

Cool, it even works over SSH! Wait, what? This lets a remote server take over
your workstation.

~~~
sbilstein
if you're able to get an ssh tunnel going to the machine...i think you already
have control over the server

~~~
danielvf
This optional feature is the other way around. When you turn it on, the
connect to a remote servers, that remote server can run commands on your local
box.

------
pacomerh
I tried this feature in the nightly version and kitty[1] and alacritty[2]
still feel faster than iterm2.

1\. [https://github.com/kovidgoyal/kitty](https://github.com/kovidgoyal/kitty)

2\. [https://github.com/jwilm/alacritty](https://github.com/jwilm/alacritty)

~~~
abledon
both of these projects need a 1080p youtube video on their homepages to show
__WHY__ i need blazing fast GPU support for a terminal

~~~
pacomerh
Hehe Yeah that's what I did actually, granted I'm a heavy vim user and feel
the difference very quickly while switching between files, scrolling, etc. But
yeah I did in fact recorded video and saw the delta there. I'm sure for most
people iterm2 is a more than enough choice.

~~~
Q6T46nT668w6i3m
I’m curious, as a non-terminal editor person, are there any other applications
where you can see or feel the benefit?

------
ninkendo
It still seems to take a long time to cat a file in iTerm compared to
Terminal.app.

In Terminal, I can cat a 1.5M line file in about 5 seconds, it takes about
twice as long in the new iTerm beta.

But iTerm is certainly updating the screen more often than Terminal (it
_looks_ smoother at least), so maybe that's because Terminal is doing a better
job of allowing the screen buffer to update independently of the drawing
thread.

~~~
hinkley
This might seem specious to some people but there have been at least two
intervals in my career where I ran into bad benchmarks of our app, because the
person doing the measurement was running it in the foreground on a subpar
terminal where writing to console was the bottleneck.

Occasionally, but less frequently, you can run into a similar symptoms just
running build scripts.

~~~
waterhouse
I remember this from the SBCL docs:

"Important: It is highly recommended that you run the make.sh script in either
a very fast terminal such as xterm (the GNOME terminal and the OS X terminal
are too slow) or that you run it in a detached GNU screen session (use C-a d
to detach the session and screen -r to resume it). The SBCL compile produces
lots of output and your system's terminal program will likely slow down the
compile in a drastic manner."

[http://www.sbcl.org/getting.html](http://www.sbcl.org/getting.html)

------
eberkund
Cool, I might give this a try and consider moving back to iTerm. I was using
it previously but decided to go back to the default Terminal + Fish shell for
better performance and not having to install an extra application.

~~~
jakear
Agreed on using standard terminal. I’d like if someone could explain what
utility they get out of iTerm (or any other non-builtin terminal).

I’ve found the performance of iTerm in particular to be far inferior to
builtin, especially when the buffer grows large. iTerm even has a fixed buffer
size by default and still has worse performance.

Alacritty is supposed to be fast, but then doesn’t support any scrolling, has
a poor window resizing flow, and doesn’t have tabs. The suggestion is to use
tmux for all that, but then Alacritty+tmux is slower than builtin.

\- “performance” above means smoothness of scrolling and general “perceived
performance” type things. Haven’t actually tried any real tests.

~~~
kccqzy
Some features I just can't live without:

* tmux integration. Whether I'm in a remote server or my own machine, just use -CC and I can now use tmux with the same keybindings I would use without tmux.

* Watch for the completion of a command. Especially useful if you happen to be using a language with a slow compiler like Haskell or Rust. Plays a nice ding when the command is done. (This may require shell integration).

* Even if you forgot to run your command with time, iTerm can still tell you the wall clock time of your command. (Shell integration too).

And then just small things that the builtin Terminal doesn't have:

* focus follows mouse * smart selection (for example it could detect a URL and you can select the whole URL, then command-click to open) * copy on select

~~~
arh68
Just wanted to note: focus follows mouse is possible with Terminal.app with

    
    
        defaults write com.apple.Terminal FocusFollowsMouse -bool true
    

[0] [https://stackoverflow.com/questions/98310/focus-follows-
mous...](https://stackoverflow.com/questions/98310/focus-follows-mouse-plus-
auto-raise-on-mac-os-x)

~~~
saagarjha
I'm pretty sure iTerm took its focus follows mouse implementation from
Terminal.

~~~
gnachman
It existed before I took it over but it has changes quite a bit since then,
kinda maybe?

------
yosito
I use iTerm 2 daily. What are y'all _doing_ in your terminals that this kind
of thing would matter at all or even be perceptible?

~~~
jimpudar
If you maximize on a 4K monitor and use tmux on a remote server there is a
pretty significant amount of latency. I never noticed until I tried alacritty,
the difference is astonishing.

That being said, iTerm2 is plenty fast enough for my purposes as it is today.

------
hellofunk
One thing I've never been able to get iTerm to do that every other iTerm user
seems to have setup almost automatically is how it ghosts the full completion
of a command you are typing (faded behind your live typing), presumably from
your history, and then you can just tab to complete the whole thing. So many
commands are repeated often and I've never been able to get mine to do this
very basic feature.

~~~
pd0wm
You are probably referring to fish shell which has this feature
([https://fishshell.com/](https://fishshell.com/)).

However, I find that zsh + ohmyzsh works just as well. After typing the
beginning of a command you can use the arrow keys to cycle through all
commands in the history with the same beginning.

A third method for efficient history search is ctrl+r. Just press ctr+r and
start typing part of the command. Then you press enter to execute or ctr+r to
cycle through the history.

~~~
gtm1260
fish is nice but I've ran into too many issues where some weird shell command
/ script I find online is expecting to be in bash and I have to switch out of
fish, so its hard for me to switch.

~~~
dagmx
As long as they don't need to be sourced, you can just add a shebang for bash
at the top of the scripts and run them via bash.

~~~
Macha
If they do need to be sourced, you can use bass:
[https://github.com/edc/bass](https://github.com/edc/bass)

~~~
breatheoften
Wow this is neat — I’m gonna try this out. Does it really work?

~~~
Macha
It works at least for nvm (caveat: Installed from nvm directly, not homebrew),
and my company's ssh setup script, which are the two reasons I've had cause to
use it.

------
sbjs
This is great! One question: when would you need 60 FPS in a terminal? What
CLIs or usages does this make a difference for?

~~~
dev_dull
It’s easier on your eyes to follow and just looks aesthetically better also.

~~~
mynameisvlad
Is it? Playing around with the Metal renderer and FPS monitor, I rarely go
above 30fps in day-to-day work, and most of the time I'm hitting 10-15fps.
There's only certain use cases where you'll _actually_ reach 60fps.

~~~
saagarjha
I get 60 FPS when scrolling.

~~~
mynameisvlad
Even when scrolling, I rarely hit 60. Most of the time, I'm staying in the 40
range and hit 60 for one or two frames.

The FPS meter only works with the Metal renderer, so I can't directly compare
it and the CPU renderer, but just from a subjective perspective, I notice
slightly worse performance from the CPU renderer while scrolling, but nothing
major.

Beyond that, though, how often are you scrolling, and how buttery smooth does
that have to be to be a good experience? While it _does_ seem smoother side-
by-side, I'm not blown away by the difference.

------
dbz
Is there somewhere we can view the feature roadmap for this? Will iTerm2
support ligatures at some point in the future? I'm also interested in future
performance enhancements, and a comparison to terminal.

~~~
coldtea
I'd just disable them. Speed and lighterweight (on CPU) rendering are more
important that ligatures and transparency, which are both gimmicky features.

~~~
bitwize
This is a Mac program. One of the reasons why the Mac has historically been
far ahead of other platforms is because its display could leverage centuries
of advances in typography, and not be confined to the a 1970s character cell
display designed by illiterates. Ligatures are extremely important for the
platform and for the audience.

~~~
jonhendry18
This is true, but terminals tend to be used with monospace fonts that aren't
very typographically complex.

That said there may? be languages other than English where ligatures are more
than decorative, and would be more useful to have in a terminal.

~~~
bitwize
I'm saying, maybe the terminals of today need to be more typographically
aware, now that the computers of today can more than support it.

~~~
coldtea
On the list that terminals need to do, being more typographically aware is on
the very bottom on my list of priorities.

They could start by not mimicking 50+ year old hardware terminals down to
arcane (and performance killing) details, supporting better and more powerful
autocomplete and similar interactions, inline images, full colors, and so
on...

------
floatingatoll
What frame rate does the built-in Terminal.app perform at in macOS 10.13?

~~~
saagarjha
It's doing 60 FPS; I just checked.

~~~
electricslpnsld
Out of curiosity how does one measure the frame rate of the terminal on macOS?

~~~
entropie
from the link (Prefs > Advanced > Show FPS meter)

~~~
saagarjha
This only works for iTerm, and only when using Metal.

------
pacuna
Iterm is probably the only thing I miss from MacOS when I'm on my Linux
machine.

~~~
alfalfasprout
Check out terminology or alacritty. Linux has a wealth of excellent terminal
emulators that IMO vastly outperform iTerm from both a performance and
functionality perspective.

~~~
patrec
A non-exhaustive list of iterm2 features:

\- killer tmux integration (tmux sessions on a remote machine behave like
normal tabbed panes, no idiotic prefix-key, broken scrolling and selection
etc. etc.)

\- the ability to rebind just left or right command keys to meta (and leave
the other one working for "normal" copy and paste etc.)

\- instant replay and generally very sophisticated output and output history
handling (e.g. it's trivial to copy the last command's output or autocomplete
from output history, all via keyboard shortcuts).

\- annotations

\- command click to open e.g. files output by ls (which requires keeping track
of cwd at output time)

\- input broadcasting

\- simultaneous search across all terminals

\- mature and polished (renders unicode, including line drawing characters
reliably, deals with large output history and many tabs etc. just fine)

\- image output

Alacrity (whilst interesting) has precisely zero of these features. In fact
I'd already be delighted to find a single linux terminal that has tmux
integration.

~~~
randallsquared
Also, the ability to have tabs and put the tab bar vertically down the left-
hand side of the terminal, but readably:
[https://imgur.com/a/6qGxNTu](https://imgur.com/a/6qGxNTu) This is the thing
that I really have to have in a terminal, because I use too many terminal tabs
to keep track otherwise: the tabs have to stay readable, and there has to be
room for 30-40 of them when I'm working.

On linux, few terminals support this, and the only one that seemed really
usable was roxterm, which was increasingly difficult to install as of Ubuntu
17.10 when I last tried, due to the ROX collection being abandoned. It looks
like there's new activity in a github repo this year, but I haven't tried it.

I built a very minimal side-tabs plugin for Zeit Hyper, but updates broke it
so regularly that I gave up (the plugin was never great, anyway, and avoiding
collisions with other tab-affecting plugins was difficult).

There are several other terminals on linux that claim to support side-tabs,
but they all have some issue or another (my "favorite" is when they "support"
side-tabs by literally rotating the tab bar so that the text of the bar is
sideways, distorted, and still shrinks as more tabs are used, which defeats
the point of using side-tabs in the first place!).

------
gigatexal
When describing the frames you are getting from the built in terminal it might
be helpful to list the specs of your machine and how it’s being used:
clamshell or not. Also how are you all getting the FPS count from terminal?

~~~
saagarjha
There are meters that tell you how many frames per second your GPU is pumping
out.

------
z3t4
Is there any side-by-side video comparison ?

------
Moter8
How come it gets disabled when not charging/plugged in? Why not let me choose?

Especially when I would want to test it right now, sitting here on my bed. :)

~~~
evanrelf
You can enable it on battery power in “Preferences > General > GPU Rendering“

------
Myrmornis
Very satisfied iTerm2 user for 7 years here. My biggest question about iTerm2
is: what is the difference between Preferences (⌘ ,) and Edit Session (⌘ I)?

The Dynamic Profiles feature is fantastic -- being able to version control a
subset of the configuration document is exactly what I wanted to be able to
do. But I'd like to understand the settings interface/model/schema better.

~~~
gnachman
Edit session divorces the session from its underlying profile so you can make
local changes to it only

~~~
Myrmornis
Thanks, and thanks for iTerm2! Btw, I have two 90% complete iTerm2-related
projects that I might mention on the mailing list at some point:

[https://github.com/dandavison/iterminator](https://github.com/dandavison/iterminator)

[https://github.com/dandavison/iterm2-dwim](https://github.com/dandavison/iterm2-dwim)

------
aschneid
There's currently a bug with multi-GPU based MBPs and the new metal renderer.
The new metal renderer causes it to always use high performance graphics
whether plugged in or not. I had to debug why my battery was dying faster than
usual and traced it back to iTerm2 and the metal renderer.

The developer was working on the fix, but I have not seen a fix announced in
the release notes yet.

------
runeks
> It is also temporarily disabled under certain conditions:

> [...]

> When your device is not plugged into a charger. This is controlled by Prefs
> > Advanced > Disable Metal renderer when not connected to power.

Why is the GPU renderer, by default, disabled unless plugged in? I’d assume
the GPU renderer uses less power...

~~~
gepeto42
Could it be that waking up the discrete GPU, on laptops that in some cases
disable it by default on battery power, takes more juice than rendering in
software on the CPU? Though I wonder how many MBPs in circulation have the
dual-GPU configuration...

------
swoongoonz
It's crazy to now see open source projects on Gitlab after the whole Microsoft
purchase of Github.

~~~
avprpl
While this may be broadly true, if I remember correctly, iTerm2 has been on
GitLab since before the acquisition.

~~~
nahtnam
How come it says that it's mirrored from GitHub and "The repository failed to
update 8 months ago. Repository mirroring has been paused due to too many
failed attempts, and can be resumed by a project master."

Seems like they are still using GitHub but use GitLab for the wiki?

~~~
sytse
They use GitLab for the issues I think.

------
rurban
Using it for a month. It's indeed much faster.

But the old annoying bug to block indefinitely on an accidental wrong Ctrl-
Enter keystroke is still there, since about a year. The regexp detection is
also pretty unstable and can block the window. Either the Semantic History or
url detection.

~~~
gnachman
Please file an issue and include a debug log

~~~
rurban
When it's locked I can only kill it. I can create a spindump backtrace, but it
happens only once a month or so.

------
azr79
No ligatures and no transparency, kind of a deal breaker and a step back,
isn't it?

~~~
gnachman
It falls back to the old renderer in these cases. Transparency will be
supported in Mojave.

------
Fannon
Is there any decently fast and simple terminal emulator for Windows?

VSCode / Hyper 2 are GPU accellerated and are really fast once loaded. Because
of their use of Electron they are not excactly fast to load, though.

~~~
gempir
Personally I found cmder together with WSL best on Windows.

~~~
Fannon
I did try this a while ago (with ConEmu instead) but got into some filesystem
issues when working outside of the lxss owns filesystem. You have no issues
there?

------
somedudeatwork
I've been using this for the past couple months by using the nightly releases.
it has been insane how much higher quality vim feels when you get 60fps
scrolling and no banding

------
bnolsen
Nice but can they make it so iterm2 doesn't always change the width of the
terminals by 2 almost every tine i plug the macbook pro i use into the dual
monitors at work?

~~~
ztjio
You have a non-touchpad mouse on a dock there that you're plugging into? If
so, you can stop this kind of annoyance by setting scrollbars permanently on
(or off) rather than auto in System Prefs->General.

Actually, try it anyway as when I first ran into this fix for such things, I
didn't have what I thought was a mouse connected, but actually some non-mouse
USB device reported to macOS that it also had a mouse on board for some
reason.

~~~
bnolsen
Thanks for the reply. I'll try this since this morning one of my desktops had
set all its terms to 72 wide, another to 74 & 78.

------
dandigangi
Has anyone had performance issues with iTerm? What were you doing? I haven't
had issues yet so I'm curious.

~~~
bostonvaulter2
I switched back to Terminal.app due to performance issues earlier this year.
Things were just feeling laggy and slow, especially with Tmux.

~~~
dandigangi
Ah, ok. Sounds like Tmux was an issue for a few people.

------
nodesocket
Argg, now do I disable transparent background windows to support it?

~~~
Exuma
I think so :(

------
codeCatalyst
> Ligatures are very hard to support in a GPU-based renderer.

Why?

~~~
gnachman
You have to analyze a row of text at once to reorder glyphs, which is
expensive and cannot be parallelized.

------
Exuma
No transparency :(

~~~
gnachman
This will be fixed under macOS 10.14! It's already enabled on the nightly
builds. The blending isn't quite right yet, but I only had a few hours to
spend on it.

~~~
Exuma
zOMG! When does that come out

