I spent a few hours in heap profilers. What I found was:
* Inefficient use of heap when building up runs of
`Action::Print(char)`.
-> Solve by adding `Action::PrintString(String)`
and accumulating utf8 bytes rather than u32 codepoints.
* Inefficient use of heap when building Quad buffers: the default
exponential growth of `Vec` tended to waste 40%-75% of the allocated
capacity, and since we could keep ~1024 of these in cache, there's
a lot of potential for waste.
-> Solve by bounding the growth to 64 at a time. This has similar
characteristics to exponential growth at the default 80x24 terminal
size. May need to add a config option for this step size for users
with very large terminals.
* Lazy eviction from the LFU caches. The underlying cache advisor is
somewhat probabilistic and has a minimum cache size of 256, making
it difficult to maintain low heap utilization.
-> Solve by replacing it with a very simple LFU algorithm. It doesn't
seem to hurt much at the default terminal size with the default
cache sizes. If we make the cache sizes smaller, its overhead is
reduced.
Some further experimentation is needed to adjust defaults, but this
should help reduce heap usage.
refs: https://github.com/wez/wezterm/issues/2626
28 lines
574 B
TOML
28 lines
574 B
TOML
[workspace]
|
|
members = [
|
|
"bidi",
|
|
"bidi/generate",
|
|
"strip-ansi-escapes",
|
|
"sync-color-schemes",
|
|
"wezterm",
|
|
"wezterm-dynamic",
|
|
"wezterm-gui",
|
|
"wezterm-mux-server",
|
|
"wezterm-ssh"
|
|
]
|
|
resolver = "2"
|
|
exclude = [
|
|
"termwiz/codegen"
|
|
]
|
|
|
|
[profile.release]
|
|
opt-level = 3
|
|
# debug = 2
|
|
|
|
[profile.dev]
|
|
# https://jakedeichert.com/blog/reducing-rust-incremental-compilation-times-on-macos-by-70-percent/
|
|
split-debuginfo = "unpacked"
|
|
|
|
[patch.crates-io]
|
|
xcb = {version="1.1.1", git="https://github.com/rust-x-bindings/rust-xcb", rev="a85a4cf8937898b1da972367df4648143ede38ea"}
|