web-font/rust-spike/Cargo.lock
崮生(子虚) 2044be3a4e perf(rust): 字体加载改 mmap 按需分页,冷读 31ms→1ms、RSS 43MB→4.8MB
- Font.data 改 FontBytes(Owned/Mapped 双形态,Deref 到 &[u8] 下游无感)
- FontCache 用 Mmap::map 替代 fs::read:只把被触及的表页(cmap/loca/字形/GSUB)载入,
  消除全量读盘和「page cache 一份 + 用户堆一份」双倍内存
- unsafe 仅限 mmap 建立/解除一处(字体库静态只读,无并发截断风险),为唯一例外
- 线上验证:容器内存 43MB→8MB,冷 Read 138ms→17ms;TS/LLRT 无 mmap 能力,本项为 rust 运行时专属优化
2026-11-04 20:43:58 +08:00

63 lines
1.5 KiB
TOML

# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "alloc-no-stdlib"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2fb6cfd47bf496ff64095c20eaba0c201404ee38714d4142fcfa1dc334fcc7a"
[[package]]
name = "alloc-stdlib"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b5c1865780388bfa186411ab5f247819487fc4864c6e9c3106611fa347586e1"
dependencies = [
"alloc-no-stdlib",
]
[[package]]
name = "brotli"
version = "9.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "627b7cfb0578f0eafce087a90fcd40add1231900b69e4d4de2d456260a4f5d81"
dependencies = [
"alloc-no-stdlib",
"alloc-stdlib",
"brotli-decompressor",
]
[[package]]
name = "brotli-decompressor"
version = "6.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34c6783f42c21c952ad7112b354f0ba2f10760e9decea5b1b60523d6e270faaf"
dependencies = [
"alloc-no-stdlib",
"alloc-stdlib",
]
[[package]]
name = "libc"
version = "0.2.191"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
[[package]]
name = "memmap2"
version = "0.9.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b0ca1155a9ecc25aa12e8313a119f32edf0255fea2f44839c4ac0a12b2ac157"
dependencies = [
"libc",
]
[[package]]
name = "webfont-rs"
version = "0.1.0"
dependencies = [
"brotli",
"memmap2",
]