p-e-w / finalterm

At last – a modern terminal emulator (NO LONGER MAINTAINED)
http://finalterm.org
GNU General Public License v3.0
3.84k stars 179 forks source link

Improve performance #150

Open p-e-w opened 11 years ago

p-e-w commented 11 years ago

Final Term's performance is currently very poor due to several issues:

Related issues will be linked to this one and closed as duplicates.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

MarkRijckenberg commented 11 years ago

Yes, there is an approximately 5 second gap between entering ls -lart in finalterm and getting the output in some cases...

bl8 commented 11 years ago

I've noticed that when my finalterm window is just sitting there doing nothing (apart from the cursor blinking), it uses around 10% CPU. Granted, the cursor blinks beautifully, with a nice fade-in and fade-out ;)

I'd suggest that as a first target for performance improvement: use less than 1% CPU when not doing anything.

p-e-w commented 11 years ago

@bl8: Do you have hardware acceleration on your system?

bl8 commented 11 years ago

Yes, I'm using the NVidia proprietary driver, version 304.88. I'm running Ubuntu GNOME 13.04, and using GNOME Shell (which I think doesn't work without hardware acceleration).

p-e-w commented 11 years ago

Partially addressed by https://github.com/p-e-w/finalterm/commit/409cc6c012a0b69a79297f10fa3c26bb24a8d3f7.

I measured a rendering speedup factor of 3-10 with this commit depending on the shell program being run.

p-e-w commented 11 years ago

https://github.com/p-e-w/finalterm/commit/30ad38119f14c9e72421979efad3c1b02231a235 brings another substantial speedup.

p-e-w commented 11 years ago

https://github.com/p-e-w/finalterm/commit/6c29e45ae835056da265af416787df4ff2a9ec83 is yet another step towards better performance.

p-e-w commented 11 years ago

And https://github.com/p-e-w/finalterm/commit/392e630b9966b5f49b790718ba2ccfeca0ad1011 is yet another one.

p-e-w commented 11 years ago

The story continues in https://github.com/p-e-w/finalterm/commit/90399eb2319d4ecdbcb74a34590993471f3d0a33.

p-e-w commented 11 years ago

As for the CPU usage mentioned by @bl8: This appears to be a Clutter/GNOME Shell problem. I see the same behavior on one of my systems and while Final Term does always use 10% CPU there as well, so does gnome-shell (and sometimes xorg as well).

p-e-w commented 11 years ago

Update on CPU usage: It turns out that disabling the cursor animation brings the idle CPU consumption close to zero, with the animation it's around 5-6% on a quadcore.

Who is to blame, then, and how can we fix it? Difficult to say IMO. The fact that the gnome-shell CPU consumption seems to be tied to Final Term's somehow suggests a bug in the rendering stack rather than FT.

p-e-w commented 11 years ago

Another piece in the CPU usage puzzle: Every animation cycle apparently forces a complete repaint of line_container, which is where the CPU usage actually occurs.

p-e-w commented 11 years ago

See https://mail.gnome.org/archives/commits-list/2009-October/msg00814.html for a Clutter application that seems to have had a similar problem.

Their solution: Disable the animation. This is a massive problem with Clutter if disabling the animation is indeed the only way to lower CPU usage.

p-e-w commented 11 years ago

Another huge performance improvement comes with https://github.com/p-e-w/finalterm/commit/bc408a9b6e900a5433010801de4bd01fedca2949, which at last brings constant-time adding of LineViews.

Final Term's performance (i.e. speed) is now roughly 8 times slower than GNOME Terminal's, which I find sufficient for an initial release. The only issue left in this bug is the absurdly high CPU consumption.

x2q commented 10 years ago

+1

ps axu takes ~60 secs and consumes only a single cpu core

output

p-e-w commented 10 years ago

@x2q: Are you using the latest master (note that the PPA is currently not building, and thus outdated)? Because on all my machines, ps axu now takes less than a single second.

schlingel commented 10 years ago

+1

When running repeatedly ant tasks (timespan is about 4h) the terminal gets so slow that I have to restart it. After that it works again, for about 4h.

arkocal commented 9 years ago

Autocomplete gets unacceptably slow after many commands are given, especially when typing frequent phrases like sudo foo. It also blocks rendering.

p-e-w commented 9 years ago

@arkocal: Yes, I noticed that, though only after I upgraded to GNOME Shell 3.10 earlier this year. Should be possible to make it a lot faster given that all autocomplete data is in memory (maybe by limiting the number of results).