From 69689d2ba1dd5efdc291da3d2a3d2fba64006889 Mon Sep 17 00:00:00 2001 From: Phil Scott Date: Wed, 20 Nov 2024 17:55:33 -0500 Subject: [PATCH] Changes Emoji dictionary to OrdinalIgnoreCase for performance This code is ran on startup, and instantiating a new InvariantCultureIgnoreCase was taking up 11ms, which was half the time in AOT. --- resources/scripts/Generator/Templates/Emoji.Generated.template | 2 +- src/Spectre.Console/Emoji.Generated.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/scripts/Generator/Templates/Emoji.Generated.template b/resources/scripts/Generator/Templates/Emoji.Generated.template index 01eaa0f..9cdba91 100644 --- a/resources/scripts/Generator/Templates/Emoji.Generated.template +++ b/resources/scripts/Generator/Templates/Emoji.Generated.template @@ -18,7 +18,7 @@ namespace Spectre.Console public static partial class Emoji { private static readonly Dictionary _emojis - = new Dictionary(StringComparer.InvariantCultureIgnoreCase) + = new Dictionary(StringComparer.OrdinalIgnoreCase) { {{~ for emoji in emojis ~}} { "{{ emoji.identifier }}", Emoji.Known.{{ emoji.name }} }, diff --git a/src/Spectre.Console/Emoji.Generated.cs b/src/Spectre.Console/Emoji.Generated.cs index 2b1d13b..0f65e2c 100644 --- a/src/Spectre.Console/Emoji.Generated.cs +++ b/src/Spectre.Console/Emoji.Generated.cs @@ -18,7 +18,7 @@ namespace Spectre.Console public static partial class Emoji { private static readonly Dictionary _emojis - = new Dictionary(StringComparer.InvariantCultureIgnoreCase) + = new Dictionary(StringComparer.OrdinalIgnoreCase) { { "abacus", Emoji.Known.Abacus }, { "ab_button_blood_type", Emoji.Known.AbButtonBloodType },