lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [lucenenet] branch master updated: PERFORMANCE: Lucene.Net.Util.UnicodeUtil::ToString(): Updated to cascade the call to Character.ToString()
Date Sat, 24 Jul 2021 19:14:45 GMT
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git


The following commit(s) were added to refs/heads/master by this push:
     new a9ada86  PERFORMANCE: Lucene.Net.Util.UnicodeUtil::ToString(): Updated to cascade
the call to Character.ToString()
a9ada86 is described below

commit a9ada86f2a7c2e8dab10d85c3d329863fc4ab018
Author: Shad Storhaug <shad@shadstorhaug.com>
AuthorDate: Wed Jul 7 17:39:59 2021 +0700

    PERFORMANCE: Lucene.Net.Util.UnicodeUtil::ToString(): Updated to cascade the call to Character.ToString()
---
 src/Lucene.Net/Util/UnicodeUtil.cs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/Lucene.Net/Util/UnicodeUtil.cs b/src/Lucene.Net/Util/UnicodeUtil.cs
index 23b1493..3d89232 100644
--- a/src/Lucene.Net/Util/UnicodeUtil.cs
+++ b/src/Lucene.Net/Util/UnicodeUtil.cs
@@ -701,8 +701,9 @@ namespace Lucene.Net.Util
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static string NewString(int[] codePoints, int offset, int count)
         {
-            char[] chars = ToCharArray(codePoints, offset, count);
-            return new string(chars);
+            // LUCENENET: Character.ToString() was optimized to use the stack for arrays
+            // of codepoints 256 or less, so it performs better than using ToCharArray().
+            return Character.ToString(codePoints, offset, count);
         }
 
         /// <summary>

Mime
View raw message