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.
Comments
Similar requests
Support metrics hinting and bi-level rendering for text
2 votes · 0 comments
Use a HarfBuzz based text system
49 votes · 0 comments
Mermaid SVG font family is not configurable, causing unfixable CJK font fallback
0 votes · 0 comments
Make auto-sharing of project an opt-in rather than the default
0 votes · 0 comments
Add support for login via GitLab, GitTea, Codeberg, Bitbucket, to add colab support and avoid GitHub walled garden.
42 votes · 0 comments
No comments yet.