From 22af9c0a33f22f07ab03e52a5e40f68277a3826c Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 2 Jun 2022 11:04:04 +0200 Subject: [PATCH] janitor: Use SharedString instead of String in GL renderer image cache We can avoid a string copy. --- internal/backends/gl/images.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/backends/gl/images.rs b/internal/backends/gl/images.rs index 55ac9f085..3c1a21ad8 100644 --- a/internal/backends/gl/images.rs +++ b/internal/backends/gl/images.rs @@ -462,7 +462,7 @@ impl CachedImage { #[derive(PartialEq, Eq, Hash, Debug, derive_more::From)] pub enum ImageCacheKey { - Path(String), + Path(SharedString), EmbeddedData(by_address::ByAddress<&'static [u8]>), } @@ -474,7 +474,7 @@ impl ImageCacheKey { if path.is_empty() { return None; } - path.to_string().into() + path.clone().into() } ImageInner::EmbeddedData { data, format: _ } => { by_address::ByAddress(data.as_slice()).into()