By cesp... on April 12, 2011 00:57 (imported from Google Code)
What steps will reproduce the problem?
Open a new iterm 2 terminal/tab.
Open a large text file with less ($ less myfile)
Scroll up and down
What is the expected output? What do you see instead?
I expect nice smooth scrolling. Instead, it is slow and sometimes jerky.
What version of the product are you using? On what operating system?
I've tested on the Alpha and the latest nightly (as of 4/10). I'm on a pretty beefy macbook pro with OS X 10.6.6.
Please provide any additional information below.
I've done some experimentation and I've had some pretty annoying results:
If I disable blur, transparency, and anti-aliasing, it's not as bad (but still noticeable).
When I enable these things individually they each seem to contribute a little bit more to the general slowness of the scrolling.
The problem is much worse in a new terminal than one with a lot of text. Watch the scroll bar as you scroll down within What steps will reproduce the problem?
Open a new iterm 2 terminal/tab.
Open a large text file with less ($ less myfile)
Scroll up and down
What is the expected output? What do you see instead?
I expect nice smooth scrolling. Instead, it is slow and sometimes jerky.
What version of the product are you using? On what operating system?
I've tested on the Alpha and the latest nightly (as of 4/10). I'm on a pretty beefy macbook pro with OS X 10.6.6.
Please provide any additional information below.
I've done some experimentation and I've had some pretty annoying results:
If I disable blur, transparency, and anti-aliasing, it's not as bad (but still noticeable).
When I enable these things individually they each seem to contribute a little bit more to the general slowness of the scrolling.
The problem is much worse in a new terminal than one with a lot of text. Watch the scroll bar as you scroll down within lessWhat steps will reproduce the problem?
Open a new iterm 2 terminal/tab.
Open a large text file with less ($ less myfile)
Scroll up and down
What is the expected output? What do you see instead?
I expect nice smooth scrolling. Instead, it is slow and sometimes jerky.
What version of the product are you using? On what operating system?
I've tested on the Alpha and the latest nightly (as of 4/10). I'm on a pretty beefy macbook pro with OS X 10.6.6.
Please provide any additional information below.
I've done some experimentation and I've had some pretty annoying results:
If I disable blur, transparency, and anti-aliasing, it's not as bad (but still noticeable).
When I enable these things individually they each seem to contribute a little bit more to the general slowness of the scrolling.
The problem is much worse in a new terminal than one with a lot of text. Watch the scroll bar as you scroll down within `less in a new terminal: it jumps around as it resizes. When there's a bunch of text, it doesn't have to resize as you scroll and the performance is better. There is some kind of correlation here.
Designs
Child items
...
Show closed items
Linked items
0
Link issues together to show that they're related.
Learn more.
More info: the problem is also a lot worse when the terminal is big. If I make the terminal really tiny the problem isn't as bad, and if I fullscreen then it gets comically bad. (I work on a 30-incher, so fullscreen = 2560x1600 px.)
In case it's relevant, I'm using my laptop screen and the external monitor.
One more update (sorry to keep spamming this): I compared to Terminal.app and discovered that it suffers from the same kind of performance degradation but to a much lesser degree. I only start to notice any kind of slowdown at all when I make my Terminal window really big (most of the screen). To try and keep the comparison fair, I have the same font in both and transparency enabled in both.
I see the same kind of problem when editing a file with vim and holding down 'j' to scroll down through the file. It's especially noticeable when using 'j' to scroll through a vim help screen (:help). I'm using iTerm2 build 0.20.20110413 on OSX 10.6.7 macbook air with an 80x24 term, opaque transparency, no blur, no background image, hidden scrollbar, and anti-aliased Monaco 10pt font.
Comment 7 by geor...@google.com on May 15, 2011 20:29
How many rows/columns does your session have when less exhibits this problem? You can get it with stty -a.
Terminal is definitely faster in this case, but I can't see any trickery that they're doing from the activity monitor sample. Both of us spend all our time drawing text AFAICT.
There's an easy but small win by keeping a per-line digest of the dirty flags (a count of the two types of dirty flags)
Comment 8 by geor...@google.com on May 15, 2011 20:34
Another thought: keep a fingerprint of each line onscreen (fp = hash(screen_char_t[i] for i=0...WIDTH-1)) . Then we can quickly detect when a line is moved from one part of the screen to another and just copy the pixels. Can't do it if there's a background image, textview size has changed, or there's been any change to the background image. This would greatly speed up scrolling on a gigantic screen. Each line would have a fingerprint computed in updateDirtyRects and invalidated when any part of it changes, then recomputed lazily.
Comment 11 by troy.bollin... on May 15, 2011 23:43
They are both about the same speed, but iTerm2 is significantly more jerky when scrolling down a line at a time. Terminal scrolls smoothly for the first second or two and then jerks intermittently, while iTerm2 is continuously jerky.
Sweet -- your latest version () seems to have kicked the slowness. All test results below with terminal window size maxed on my display at 235x60.
In version 0.20.20110526, test results:
RESULTS BLUR ENABLED:
$ time
real 0m0.053s
user 0m0.001s
sys 0m0.006s
RESULTS BLUR DISABLED:
real 0m0.054s
user 0m0.001s
sys 0m0.005s
In version 0.20.20110512, test results:
RESULTS BLUR ENABLED:
$ time cat garbage.txt
real 0m9.359s
user 0m0.001s
sys 0m0.007s
BLUR DISABLED:
$ time cat garbage.txt
real 0m7.537s
user 0m0.001s
sys 0m0.007s
Using ITERM 1:
$ time cat garbage.txt
real 0m0.317s
user 0m0.001s
sys 0m0.005s
My test script:
$ cat garbage.pl #!/opt/local/bin/perl
while (
There was an error rendering this math block. KaTeX parse error: Expected '}', got 'EOF' at end of input: …00) { while (
I'm trying beta 2 and the jerkiness seems greatly improved -- in fact, in my subjective testing it feels pretty much on par or better than Terminal.app.
Comment 19 by ...@wincent.com on April 02, 2014 15:28
(Reviving an old ticket...)
With the current release (1.0.0.20140112) I'm still seeing a pretty big delta between Terminal.app and iTerm 2 performance.
I modified the (Reviving an old ticket...)
With the current release (1.0.0.20140112) I'm still seeing a pretty big delta between Terminal.app and iTerm 2 performance.
I modified the garbage.pl(Reviving an old ticket...)
With the current release (1.0.0.20140112) I'm still seeing a pretty big delta between Terminal.app and iTerm 2 performance.
I modified the `garbage.pl script from comment 16 above to produce a 1,000,000 line file and ran some tests. Out of the box, Terminal.app can dump this file to the screen in 6-7 seconds (this is with the window at maximum size on my 13" laptop display).
iTerm 2 was taking about 4 times as long (21-26 seconds).
I already have the "expensive" features (background transparency, blur, images) turned off, so I went looking for other possible candidates:
- disabled the scrollbar (no effect)
- turned off unlimited scrollback; setting scrollback to 0 brought the time down to 12-13 secs (about twice as slow as Terminal.app)
Any other ideas for settings that could be tweaked to improve performance? The feature set and stability are great now; performance is really the only department in which iTerm 2 isn't winning.
Comment 22 by ...@wincent.com on August 08, 2014 17:11
Just wanted to chime in again. I still occasionally see big slow-downs in iTerm 2. The current instance I have has been running for about 2 days and was getting painfully slow (eg. redrawing during scrolling in Vim taking several hundred milliseconds per update). I opened Terminal to compare, connected to the same remote host, same tmux session, and scrolling was buttery smooth. I quite iTerm 2 and re-opened it, and scrolling was fast again.
I have "Scrollback Lines" set to 0, and "Unlimited scrollback" is unchecked, so it's not related that but it is somehow related to the age of the session.
Currently on Build 1.0.0.20140629 (worth moving to 2.0?).
Comment 24 by ...@wincent.com on August 11, 2014 18:32
It seems the nightly is a bit of a mixed bag; raw output seems to be faster, as measured by It seems the nightly is a bit of a mixed bag; raw output seems to be faster, as measured by timeIt seems the nightly is a bit of a mixed bag; raw output seems to be faster, as measured by `time:
Terminal.app
- cat 1m lines: 6.623s (best of 3 runs)
1.0.0.20140629
- cat 1m lines: 16.715s (best of 3 runs)
2.0
- cat 1m lines: 17.702 (best of 3 runs)
2.9.20140811-nightly
- cat 1m lines: 11.219s (best of 3 runs)
But running the same test inside tmux reveals some warts:
That last figure is highly suspicious however; it appears that the It seems the nightly is a bit of a mixed bag; raw output seems to be faster, as measured by time:
Terminal.app
- cat 1m lines: 6.623s (best of 3 runs)
1.0.0.20140629
- cat 1m lines: 16.715s (best of 3 runs)
2.0
- cat 1m lines: 17.702 (best of 3 runs)
2.9.20140811-nightly
- cat 1m lines: 11.219s (best of 3 runs)
But running the same test inside tmux reveals some warts:
That last figure is highly suspicious however; it appears that the timeIt seems the nightly is a bit of a mixed bag; raw output seems to be faster, as measured by time:
Terminal.app
- cat 1m lines: 6.623s (best of 3 runs)
1.0.0.20140629
- cat 1m lines: 16.715s (best of 3 runs)
2.0
- cat 1m lines: 17.702 (best of 3 runs)
2.9.20140811-nightly
- cat 1m lines: 11.219s (best of 3 runs)
But running the same test inside tmux reveals some warts:
That last figure is highly suspicious however; it appears that the `time command exits long before tmux has finished repainting the screen. While the time for 1.0.0 felt close to right, the 2.9 time was an order of magnitude off (ie. it actually took close to 10 minutes before control was returned to the terminal).
I repeated this with a smaller file (10k lines). It seems the nightly is a bit of a mixed bag; raw output seems to be faster, as measured by time:
Terminal.app
- cat 1m lines: 6.623s (best of 3 runs)
1.0.0.20140629
- cat 1m lines: 16.715s (best of 3 runs)
2.0
- cat 1m lines: 17.702 (best of 3 runs)
2.9.20140811-nightly
- cat 1m lines: 11.219s (best of 3 runs)
But running the same test inside tmux reveals some warts:
That last figure is highly suspicious however; it appears that the time command exits long before tmux has finished repainting the screen. While the time for 1.0.0 felt close to right, the 2.9 time was an order of magnitude off (ie. it actually took close to 10 minutes before control was returned to the terminal).
I repeated this with a smaller file (10k lines). timeIt seems the nightly is a bit of a mixed bag; raw output seems to be faster, as measured by time:
Terminal.app
- cat 1m lines: 6.623s (best of 3 runs)
1.0.0.20140629
- cat 1m lines: 16.715s (best of 3 runs)
2.0
- cat 1m lines: 17.702 (best of 3 runs)
2.9.20140811-nightly
- cat 1m lines: 11.219s (best of 3 runs)
But running the same test inside tmux reveals some warts:
That last figure is highly suspicious however; it appears that the time command exits long before tmux has finished repainting the screen. While the time for 1.0.0 felt close to right, the 2.9 time was an order of magnitude off (ie. it actually took close to 10 minutes before control was returned to the terminal).
I repeated this with a smaller file (10k lines). `time reported a total duration of 1.5s, but the time measured by wall clock was actually 102 seconds... This is with tmux 1.9a installed via homebrew. I tested 2.0 and the reported duration was around 1.3s, and the wall clock was very close to the same (1-2 seconds), so this seems like a regression in the nightly.
I use tmux basically full-time, so this is a blocker for me.
I'd like to reproduce what you're seeing in tmux. I tried doing this:
Run tmux 1.9a on Mac OS 10.9. Note this is not the tmux integration with the -CC argument, just plain tmux with all default config settings.
Print 1 million lines of random ascii output, where each line is a random length (distributed uniformly) between 0 and 100 characters in length.
But the wall clock time was reasonable (10-20 seconds, certainly not 10 minutes).
If you're using a very old machine with a single core, that could possibly explain some of this, but even so, what you're seeing is crazy. Could you do this:
Start a new shell, not in tmux yet
Do Shell>Log>Start
launch tmux
cat the 10k line file that took 102 seconds of wall time
Do Shell>log>stop
Exit tmux
Verify that printing the log file to the screen takes about 100 seconds.
Attach the log file to this issue
Also attach your ~/Library/Preferences/com.googlecode.iterm2.plist file to this issue
Comment 26 by ...@wincent.com on August 12, 2014 14:51
Attaching the log and the plist file.
I obtained the log using the steps you specified. Same as yesterday, cating the file took almost two minutes, even though Attaching the log and the plist file.
I obtained the log using the steps you specified. Same as yesterday, cating the file took almost two minutes, even though timeAttaching the log and the plist file.
I obtained the log using the steps you specified. Same as yesterday, cating the file took almost two minutes, even though `time claims it only took a couple of seconds. Outside of tmux, the same file cats basically instantly.
Also attaching the Perl script I used to generate the test file. It makes a file 10k lines long, 360 characters per line (ie. wide enough to almost fill the entire terminal when it is at full size on my external display).
All of this is on a mid-2013 MacBook Air 1.7 GHz Intel Core i7 (4 cores) with 8 GB 1600 MHz DDR3 running OS X 10.9.4 and tmux 1.9a from homebrew (updated yesterday) without the iTerm integration. This machine has Intel HD Graphics 5000 integrated graphics, and is driving a 2560x1440 Apple Thunderbolt Display, which is where I ran these tests with the iTerm window maximized to about 364 x 81 chars.
To sanity check, I retested with 2.0 (not the nightly) and it doesn't exhibit this problem.
In case it matters, you can see my .tmux.conf here:
Yesteraday I was originally suspicious that my c0-change-trigger and c0-change-interval settings might be involved, so I commented those out and closed all tmux sessions and re-ran the tests. The behavior is the same.
Scrolling still feels laggy when a background image is set. The problem doesn't occur when the iTerm window is small. In Terminal.app everything works smooth (even if the window is full screen).
Just tried the 12/25 nightly, but couldn't detect any speed improvement over the build I was previously using (Build 3.0.20161213-nightly):
3.0.20161213, outside tmux0.00s user 0.81s system 11% cpu 6.919 total3.0.20161213, inside tmux0.00s user 1.22s system 1% cpu 1:23.94 total3.0.20161225, outside tmux0.00s user 0.80s system 11% cpu 6.899 total3.0.20161225, inside tmux0.00s user 1.29s system 1% cpu 1:24.73 total
(1 million lines, best of three runs for each.).
I'm using Adobe Source Code Pro Light, so I don't think ligatures are at issue here.
FWIW, there was a regression in tmux that I reported here which highlighted that rendering performance can still be a problem at large window sizes. Quoting this comment:
It looks like your terminal just can't keep up with the volume of data once we start redrawing, so the amount of data that tmux has buffered gets bigger and bigger.
1491313185.674857 /dev/ttys011: wrote 1024 bytes (of 74365)...1491313192.568442 /dev/ttys011: wrote 1024 bytes (of 38423119)
That issue has a mitigation that causes tmux to slow down updates when it detects that the terminal isn't keeping up. With the mitigation in place, tmux + less is usable in large windows in iTerm (specifically, I am using Build 3.1.20170331-nightly
with no ligatures or anything fancy), but Terminal.app is noticeably smoother still. The tmux maintainer can't repro the issue, so whatever (presumably Linux) terminal he is using is fast enough for this not to manifest inside it.
@linuxinit In your first video, were iTerm2 and Terminal doing the same thing? I barely saw the Terminal window change. What kind of machine are you on and what resolution display are you using, if it's external?
both terminals are attached to the same tmux session.
iterm outputs WAY slower than terminal. when you say you barely saw the terminal window change, that's because it didn't lag and buffer and choke on the output. it's done rendering before iterm even begins to choke.
as for the machine... it's a macbook pro running an external 4k display (samsung U28D590D) via mini display port (over thunderbolt) via another thunderbolt device doing daisy chain. i don't think the display is the issue, however... as you can see both terminals running on the same display, side-by-side, in real time, so i'm not really sure how the display is really relevant.
it seems to be some kind of issue with output buffering, you can see it trying to redraw everything for each line that is outputted, where-as terminal does it MUCH faster, not sure if it's just skipping draws or what.
I have made a few changes that will improve performance for most users, at the expense of annoying a minority.
The cause of poor performance is ligature support. It forces the use of Core Text, which is extremely slow compared to Quartz. Apple seems to mitigate this by not using NSScrollView and having a very flat view hierarchy. At least, that's all I can figure.
The default fonts that ship with the system do not have ligatures and so I have disabled the ligature code path for them.
The riskier change (in terms of people filing lots of issues) is that ligature support is now off by default. If you were using ligatures, you'll need to re-enable them in Prefs > Profiles > Text.
On my system, disabling ligatures improves drawing performance by a factor of almost 5x.
For what its worth, I have similar issues in the beta, Build 3.1.beta.5 (i've had them for a while, an they were gone for quite some time, but seem to have returned). I've added the output of my iterm2 logs: