Skip to content

Conversation

@fee1-dead
Copy link
Contributor

@fee1-dead fee1-dead commented Nov 18, 2021

See also alacritty/crossfont#35. Current PR includes a patch to Cargo.toml using my fork. Will change after the crossfont PR gets merged.

@AlexApps99
Copy link

Image of it in action:
image

@fee1-dead
Copy link
Contributor Author

From the CI logs it looks like allsorts does not support the MSRV of alacritty. What do you think is the best action here @chrisduerr?

Copy link
Member

@chrisduerr chrisduerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the CI logs it looks like allsorts does not support the MSRV of alacritty. What do you think is the best action here @chrisduerr?

MSRV can be bumped up to the latest stable Rust version available in the Ubuntu repos. If that isn't enough, allsorts is unsuitable.

Why did you pick allsorts over a library that is actually reliably tested?

@chrisduerr
Copy link
Member

@perfbot

@perfbot
Copy link

perfbot commented Nov 18, 2021

results

@fee1-dead
Copy link
Contributor Author

fee1-dead commented Nov 18, 2021

Why did you pick allsorts over a library that is actually reliably tested?

Because allsorts is rust native. It removes the need of a third party FFI crate, so no FFI overhead and it is cross platform. If you would prefer using Harfbuzz, then I can switch over to Harfbuzz, but I am no expert in coretext and uniscribe to be able to easily come up with a windows/mac support.

Would you like me to open another PR that uses harfbuzz to compare their performance?

@chrisduerr
Copy link
Member

Would you like me to open another PR that uses harfbuzz to compare their performance?

I think as the person proposing this change, you should test the performance implications of different solutions. And I'd like to point out that the previous test only verified potential PTY lock contention issues, while the change itself will most likely impact framerate. So to actually verify the performance of these benchmarks one must record the rendering framerate.

Because allsorts is rust native.

That seems more like an argument for laziness rather than picking the correct solution. As far as I'm aware there's basically nobody using allsorts; it's a new library without a lot of development time behind it that has largely dried up over the past 4 months. So all things considered the argument really should be made why not to choose the reliable standard Harfbuzz that has been tweaked wrt API stability and performance for decades.

@fee1-dead

This comment has been minimized.

@fee1-dead
Copy link
Contributor Author

fee1-dead commented Nov 18, 2021

Oops, I retract that comment, that was a bad mistake. I forgot to build with release mode.

EDIT: to be honest there is not much of a difference to me. I couldn't tell the difference between allsorts and harfbuzz and no shaping

@chrisduerr
Copy link
Member

chrisduerr commented Nov 18, 2021

EDIT: to be honest there is not much of a difference to me. I couldn't tell the difference between allsorts and harfbuzz and no shaping

Define "tell the difference". You shouldn't have to try and tell anything, benchmarks should always be measured in metrics that can be tracked and compared against each other. So either there is a framerate difference or there isn't. Also of course since vsync might limit the framerate, one should ensure to decrease the font size until Alacritty starts struggling since ultimately that's where this starts to matter.

I'd personally assume that Harfbuzz outperforms Allsorts, I think one of the contributors to Allsorts has told me that before. But one still needs to actually compare the numbers directly to see how much it would differ.

@chrisduerr
Copy link
Member

That is not a benchmark lol. Calling it a rough estimate would probably still give it too much credit.

@fee1-dead
Copy link
Contributor Author

I still have the binaries. I am not really familiar with measuring performance of terminals. Could you please provide with some instructions or tools to generate data with? Thank you.

@chrisduerr
Copy link
Member

Benchmarking workloads are part of Alacritty's contribution documentation, measuring framerates depends both on your hardware and software so you'll have to figure that out on your own (though it's likely the more relevant piece of information here).

@fee1-dead
Copy link
Contributor Author

fee1-dead commented Dec 18, 2021

Hello, I'm back.

typometer

Screenshot from 2021-12-18 19-41-45

vtebench

output

framerate

I used mangohud to observe the framerate of cat /dev/urandom on wayland with font size set to 1. The MangoHUD program does have a logging option but it is unavailable under wayland. Running cat /dev/urandom on Xorg unfortunately freezes the X server so I had to observe the average via human eye.

Baseline (no shaping, commit before either change): ~17.1 ms, 58 fps on average

image

Shaping with allsorts: ~32.1 ms, 31 fps on average

image

Shaping with harfbuzz: ~23.4 ms, 42 fps on average

image

binary size

EDIT: based on ldd it looks like harfbuzz is dynamically linked. this comparison is meaningless.

$ ls -al alacritty_* | awk '{ print $(NF)"  "($(NF-4))" bytes" }'
alacritty_allsorts  35448344 bytes
alacritty_baseline  32224528 bytes
alacritty_harfbuzz  32291456 bytes

I think the overall assessment is that harfbuzz is superior.

@chrisduerr
Copy link
Member

That rendering performance seems awful for both harfbuzz and allsorts, considering that the baseline is probably only at 60 because it's limited by vsync. And that's with a trivially slow benchmark like cat /dev/urandom.

@fee1-dead
Copy link
Contributor Author

Well, at least we know which library to choose. I'll try to improve performance with harfbuzz.

@fee1-dead
Copy link
Contributor Author

Also, note that cat /dev/urandom is probably biased against shaping engines because they output a lot of characters that shaping engines don't recognize. That means fallback paths will be executed more often than a daily use scenario.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants