From 41cd6a88aac701cbf1a220bbc73cf3aa4e78bbff Mon Sep 17 00:00:00 2001 From: pjh456 <147148383@qq.com> Date: Sun, 13 Sep 2026 09:05:57 +0000 Subject: [PATCH] =?UTF-8?q?docs:=20JsString=20=E5=B8=83=E5=B1=80=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=E6=8C=89=E5=AE=9E=E6=B5=8B=2032B=20=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=81=8F=E7=A7=BB=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/oxide_types/src/object.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/oxide_types/src/object.rs b/crates/oxide_types/src/object.rs index 8c272104..5930769a 100644 --- a/crates/oxide_types/src/object.rs +++ b/crates/oxide_types/src/object.rs @@ -21,9 +21,10 @@ use std::sync::OnceLock; /// 惰性扁平化缓存)。二元 `+`/`+=` 拼接 O(1) 链接不拷贝文本,整块文本在 /// 首次消费时扁平化并原子发布。 /// -/// 结构体大小恒为 40B(`Flat(String)` 24B + utf16_len 4B + tag),较 rope 前的 -/// 32B 大一个分配 bin 级,但换来 `String` 原样存储(零 realloc 收缩);Cons -/// 专属状态(子节点/产物缓存)独立分配在 [`ConsNode`],仅大链持有。 +/// 结构体大小恒为 32B:`Flat` 内联 `String`(cap@0 / data@8 / len@16), +/// `Cons` 首字为 tag(0xffff_ffff_ffff_ffff)@0、子节点指针@8;`utf16_len` +/// 两形态统一 @24(4B),尾部 4B 填充。`String` 原样存储(零 realloc 收缩); +/// Cons 专属状态(子节点/产物缓存)独立分配在 [`ConsNode`],仅大链持有。 /// /// 生命周期约定: /// - `Cons` 子节点各自独立登记 session 字符串表(或为 perm 串),由 GC 的