New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Significant startup time #782
Comments
I just tried with an older build and after a git pull and got more or less the same duration ~120ms. |
It's an intel HD520, and I don't have the DDX driver installed (so modesetting). |
I also wish alacritty's startup time was near instant, it's a surprisingly large component of what I look for in my preferred terminal (I would probably switch to alacritty from gnome-terminal if it just started faster). Latency matters. I tried changing some font / dpi settings and that seemed to affect the startup time too, so who knows which factors cause the most latency. Has a server-client mode for alacritty ever been considered? |
There's some pretty low hanging fruit in this area still before we consider something like a client-server model. For instance, we don't even start the shell (or whatever program) until after the renderer is fully initialized. We have plans (#673) to put the renderer on a secondary thread which will help both startup time and input latency. |
Not really sure what happened but startup performance seems to have, as of now, significantly improved! I'm assuming putting the renderer on a separate thread would still be helpful as a takes a brief bit for the window to draw after the frame opens, but it still seems much faster overall. |
I get the following results on a GTX970 with NVIDIA 387.12 drivers and Alacritty @geb231b3:
Run with |
I took a flamegraph out of curiosity, and a surprisingly long time seems spent in libfontconfig and libfreetype. |
I just started using the 0.2.0 version because of the scrollback feature. |
I've seen this too. And that's why I dropped the scrollback history to only 1000. Anecdotally (it was quite a while ago when I made that change and I didn't measure it at the time, so take with a grain of salt) that more that halved the startup-time from when scrollback history was at 10,000 |
With current (release build) master, 80% of callgrind time for For sake of comparison, If startup latency is really important to you, a workaround that I've used for some of my programs is to set up a ~50MB bitmap file containing images corresponding to all ~137,000 allocated unicode code points, prerendered in grayscale at my usual font size. Then font loading reduces to calling mmap once and copying memory as needed. The obvious downside is that combining characters, color emoji, oversize characters, and other unicode features are unavailable. (Of course, for some tasks, this "downside" is a feature.) |
There has been some further discussion and profiling on this issue in #1603. I'd be interested to see how Linux and MacOS are different here. So far it seems like most reports are about fontconfig. However if there are caching issues on linux, it's not unlikely they are present on MacOS too. |
So, specifically the insights from #1603 is that the |
Using some manual tracing (callgraph generator when) I found the following path to
I'll see if I can eliminate this. |
I'm kind of thinking that I want to try pulling in the font-kit crate rather than investing more time in our own font abstraction. I did some research yesterday on how Pango is doing fallbacks with fontconfig, and I've come to the conclusion that we are pretty far off the mark with our impl. |
That sounds like a good idea, do you think it makes sense to start of by writing implementing our current font API for font-kit or adapting the current renderer to font-kit's API? |
In one of my linux laptops, this is issue is particularly severe: 2s for I've tried to generate a flamegraph from master (uploaded along the setup and times) in this gist: https://gist.github.com/kimsnj/6ee1a1992c856fb6a68ee94bee4780d1 Update: The issue on my laptop does not seem linked to fonts, but to winit… which takes 2seconds to create the window. I updated the gist with logs that clearly show this. |
@kimsnj yeah, that's where I ended up too. It's been filed as rust-windowing/winit#682. |
The startup time for me (measured via
|
@anowlcalledjosh can you give rust-windowing/winit#682 (comment) a try? |
@jonhoo With that version of |
Just wanted to attach my benchmarks on wayland, in case it's at all helpful: # Dell XPS 15" 9560 (just the laptop screen, no external monitors, no touchscreen)
# sway version 1.0-rc1-148-g0df76ed9 (wayland, wlroots)
# alacritty 0.2.9 (`alacritty-git` AUR package, autogenerated alacritty.yml)
$ time alacritty -e bash -c sleep 0
==> alacritty -e bash -c sleep 0 0.10s user 0.04s system 29% cpu 0.475 total
$ time termite -e false
==> termite -e false 0.08s user 0.02s system 101% cpu 0.101 total
# If I disable wayland, it's fast:
$ export WAYLAND_DISPLAY="" ; time alacritty -e false
==> alacritty -e false 0.06s user 0.02s system 82% cpu 0.099 total Note: I did Please let me know if there's anything I can provide that might be helpful. I'm really excited to see alacritty take off 🚀 |
If they really rely on that they could patch build script, I guess. |
My patch is not intended to be a real long-term solution, it's a hack for personal use. I've noticed that issue with the alpha blending but never bothered to fix it because it doesn't affect me. (I only really use a terminal emulator maximized against a solid color background) |
At which point it's not supported anymore though. A bit like stating that Alacritty supports having videos as the background, you just need to write the code to patch it in. That's exactly what not supporting it is. |
Nice. |
Trying alacritty for the first time on my X1 Carbon 7th Gen, Intel Graphics. Version 0.8.0. Running Ubuntu 20.04 with i3 and compton. As soon as I add 2 external monitors, alacritty takes a large amount (>1sec) of time to start. In all these tests of Internal 4k: 0.212s real For some reason the addition of that last FHD monitor seems to cause alacritty to take a full extra second to start up. I don't see this issue at all with gnome-terminal (or anything else, that I can think of). I note the description of an apparently identical issue with alacrity, but in the winit issue tracker, but that was supposedly fixed 2 years ago. Any ideas? |
Experiencing slow start on X1 Carbon 8th Gen, running Arch/dwm. |
Following "benchmarks" on Arch and DWM:
|
Are there any solutions to this issue? |
The issues related to GPU drivers (which seem most of the things mentioned here so far) might be relieved somewhat with #5403. That should skip the driver loading time for new windows from the same instance. |
I’m also affected by the very long startup time when using an external monitor! My setup:
This is what I can measure:
And my
|
@cagprado The external monitor issue sounds related to synchronisation being underspecified in opengl. 200ms sound okayish to me, if all other shells dont support unicode. |
Just chiming in here and wondering if there is any progress on this issue. This seems like the best terminal emulator out there but this startup lag is spoiling the fun a bit :)
Nvidia native driver (Nouveau not supported). Killing compositor kills startup time in half, but I need that to avoid tearing (yes nvidia sucks). |
I use nvidia's proprietary driver too, and you might want to try to disable "allow flipping" like so in nvidia settings. |
Thanks, disabling that speeds up Alacritty's startup time a little (50ms) but it causes tearing again in my browser (Brave/Chromium). I've tried different picom backends and settings in the past, but my current configuration is the only one that is workable it seems. My next card probably won't be an Nvidia .. Now I also just noticed that resizing a tiled (bspwm) alacritty window is super slow so there is more to this it seems. I have zero issues with st, urxvt and others. If your startup times are significantly better than mine I would love to see your Nvidia/Picom config. |
I don't have any tearing with nvidia, even without picom, but I have this
inside Added it in few years ago, inspired by wiki. startup times
100ms better than yours. (gtx 970). But when nothing aside from alacritty is open, I've seen as low as 115ms. St is still better, tho (~40-50ms). picom
Note that I use latest git version and run
Mine won't be too ;) Also, while I haven't noticed a significant difference between SyncToVBlank = 1 or 0, I run both But I think what you're missing is probably triple buffering. Enabling it lowers latency by about 35ms.
I think this is general issue with programs that use glx (probably because, as always, nvidia, but idk), regardless of compositor. E.g. mpv has same issues for me (also on bspwm, but used i3, dwm and qtile before that - same), with or without picom. |
Closing this issue because there's really nothing left to be done in general as far as the original report is concerned. Most issues here boil down to slow drivers which is not something Alacritty can fix, but it can be sidestepped with the new multiwindow feature. Should there be any other issues causing slow-downs that aren't driver related, I encourage people to open separate issues. That way those can actually get fixed. |
Just to make it clear and easier to understand for users that end up here: This feature can be used by calling Benchmark for my system with nvidia drivers: ❯ time alacritty -e false
alacritty -e false 0.05s user 0.06s system 29% cpu 0.349 total
❯ time alacritty msg create-window -e false
alacritty msg create-window -e false 0.00s user 0.00s system 93% cpu 0.003 total
|
This is inaccurate and misleading. It's just not possible to measure the startup delay anymore, that doesn't mean it doesn't exist. While the startup delay of a new window should be lower than the delay of a new window, it is nowhere near as fast as your "benchmark" suggests. All you're testing is the time it takes to write to the Alacritty socket. |
Got it, any idea on how to measure the true wallclock time in this case then? But anyway, using the |
I can't think of any way to do this without modifying the code to include timers. And even then that isn't necessarily directly related to the time things are actually shown on the screen by your compositor. So the most reliable way? High-speed camera probably. |
This issue is closed but still happening randomly and it is quite painful (note the timestamp in the logs):
I'm running on Arch, with |
If that can help us debug it, then here's mine (modern Ryzen, newer integrated amdgpu gfx):
I see |
@dm17 You can do something like this: |
Thanks a lot! Works great... Much more usable, no worries about the first launch. I wonder why this isn't default behavior. |
For anyone lurking around here like me searching for a solution for bindsym Mod1 + Return exec --no-startup-id "alacritty msg create-window || alacritty" ; focus Ofc feel free to customise it according to your configs. |
The
So the correct version would be
where |
Linux, X11. Using eb231b3, release build (the AUR one).
Starting up alacritty takes a significant amount of time. Simply doing
time alacritty -e false
reports about 390ms. Other terminal emulators, such asurxvt
ortermite
start much faster, at about 160ms for both.It's also not just a matter of this simple benchmark, in normal usage it also feels slower to start.
The text was updated successfully, but these errors were encountered: