contour-terminal / contour

Modern C++ Terminal Emulator
http://contour-terminal.org/
Apache License 2.0
2.32k stars 102 forks source link

Improve startup time on macOS #1380

Closed erf closed 2 weeks ago

erf commented 6 months ago

Abstract

Startup time now on macOS is about ~3 seconds whilst other popular terminals open in about 1 second.

Motivation

Specification

christianparpart commented 6 months ago

Many thanks for all of your tickets, @erf. On this one, this is because it's an x86-64 build running on an Apple M1 (ARM64), where Apple Rosetta 2 is doing an initial JIT-transpiling into an ARM64 executable. I realise that Alacritty is faster, but Warp terminal is slower than Contour in startup-times.

I am sure there's something we can optimize in general startup performance, regardless of the platform (MacOS), which is initial font fallback discovery (because that's done at process startup, but could easily be cached, or lazy-loaded as needed).

We could also start providing native Apple M1 executables on the release page (I am mainly using an Apple M1 as well, where i'm - apart from running OS/X - also run ARM64 based Linux VMs daily). 🤔

erf commented 6 months ago

That makes sense! i Run on a m1 macbook. Building a universal build including Apple Silicon would probably make it much faster!

BTW: I tested against Terminal.app, iTerm2.app, Wezterm and Ghostty and they were all about 1 sec

christianparpart commented 2 weeks ago

@erf Assuming you are (still) on ARM64 macOS, the startup-time should now be waaay better, because the next release (and master branch CI-builds) are native ARM64 (Apple silicon) builds.

I compared roughly against iTerm, Alacritty and Kitty. I think Kitty is still the fastest. But also, we did not really actually do any actual code path optimizations for startup-time (there is room for improvement, but this would then apply to every platform :) )

I am going to close this ticket now, because we're definitely down from 3s to way below 1s. If you feel the need for further improvement, please continue chatting here, join Discord, or subscribe to repo updates, because I'd still like to work on further improving general startup-time. :)