From 9d98d26cc7e6813e8736bec5ea609c85b58fff75 Mon Sep 17 00:00:00 2001 From: AT <14300910+theClueless@users.noreply.github.com> Date: Sat, 16 Nov 2019 01:28:07 +0200 Subject: [PATCH] added log into Alphabet service since it can induce a large perf hit --- Wox.Infrastructure/Alphabet.cs | 6 ++++++ Wox.Infrastructure/StringMatcher.cs | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Wox.Infrastructure/Alphabet.cs b/Wox.Infrastructure/Alphabet.cs index 91979bf526..d7fae882cb 100644 --- a/Wox.Infrastructure/Alphabet.cs +++ b/Wox.Infrastructure/Alphabet.cs @@ -117,6 +117,12 @@ namespace Wox.Infrastructure return false; } + if (word.Length > 40) + { + Log.Debug($"|Wox.Infrastructure.StringMatcher.ScoreForPinyin|skip too long string: {word}"); + return false; + } + var chinese = word.Select(PinyinHelper.toHanyuPinyinStringArray) .Any(p => p != null); return chinese; diff --git a/Wox.Infrastructure/StringMatcher.cs b/Wox.Infrastructure/StringMatcher.cs index 9c49b4119b..5b82b18918 100644 --- a/Wox.Infrastructure/StringMatcher.cs +++ b/Wox.Infrastructure/StringMatcher.cs @@ -131,12 +131,6 @@ namespace Wox.Infrastructure { if (!string.IsNullOrEmpty(source) && !string.IsNullOrEmpty(target)) { - if(source.Length > 40) - { - Log.Debug($"|Wox.Infrastructure.StringMatcher.ScoreForPinyin|skip too long string: {source}"); - return 0; - } - if (Alphabet.ContainsChinese(source)) { var combination = Alphabet.PinyinComination(source);