LibGUI: Speed up Variant string conversion for string data

Add a fast path to Variant::to_deprecated_string() to return a copy
if the underlying data is of type DeprecatedString. This improves the
performance of models with a lot of string data.
This commit is contained in:
Tim Ledbetter 2023-02-09 19:19:17 +00:00 committed by Ali Mohammad Pur
parent adb1c842c2
commit 99570cb0c4
Notes: sideshowbarker 2024-07-17 08:25:15 +09:00

View file

@ -204,6 +204,7 @@ public:
{
return visit(
[](Empty) -> DeprecatedString { return "[null]"; },
[](DeprecatedString v) { return v; },
[](Gfx::TextAlignment v) { return DeprecatedString::formatted("Gfx::TextAlignment::{}", Gfx::to_string(v)); },
[](Gfx::ColorRole v) { return DeprecatedString::formatted("Gfx::ColorRole::{}", Gfx::to_string(v)); },
[](Gfx::AlignmentRole v) { return DeprecatedString::formatted("Gfx::AlignmentRole::{}", Gfx::to_string(v)); },