FeatureFuel
0

GPUI: Support static and shared SVG data without copying bytes

Source: zed-industries/zed#65066 · opened by @suxiaoshao
Problem GPUI's Svg::data(&[u8]) always copies the input into Arc<[u8]>, hashes all bytes, and allocates a synthetic string path for the sprite cache. This also happens when the caller already has shared immutable bytes or an embedded include_bytes! resource, and when recreating elements from the same data. Verified on main at 2a97fbf22b, in crates/gpui/src/elements/svg.rs. This is an API/ownership limitation; I have not measured an application-level performance regression. Proposed GPUI API Introduce a cloneable gpui::SvgData with: Static construction would borrow the embedded bytes, shared construction would retain the existing allocation, and borrowed slices would retain the existing copy semantics. Array-reference conversions should preserve direct byte-literal and include_bytes! calls. Explicit from_static avoids overlapping conversions for static and non-static slices. Carry the data and reusable cache identity through GPUI's SVG rendering path. Keep d…

No pledges yet. Be the first to back this.

Make a pledge

Pledge your monetary support if this feature is added.

$

Comments

No comments yet.

Replying to

Add a comment

What do you think about this feature request?


Similar requests