You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2022/10/31 06:19:15 UTC

[lucenenet] 07/14: PERFORMANCE: Lucene.Net.Analysis.Util.SegmentingTokenizerBase: Removed unnecessary string allocations that were added during the port due to missing APIs.

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

commit e3606755c3301b88a77b5e7271164f2796cf557f
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Thu Oct 27 01:35:02 2022 +0700

    PERFORMANCE: Lucene.Net.Analysis.Util.SegmentingTokenizerBase: Removed unnecessary string allocations that were added during the port due to missing APIs.
---
 .../Analysis/Util/SegmentingTokenizerBase.cs                        | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/SegmentingTokenizerBase.cs b/src/Lucene.Net.Analysis.Common/Analysis/Util/SegmentingTokenizerBase.cs
index d19b8f827..576a0c473 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Util/SegmentingTokenizerBase.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/SegmentingTokenizerBase.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 #if FEATURE_BREAKITERATOR
 using ICU4N.Text;
 using Lucene.Net.Analysis.TokenAttributes;
@@ -105,7 +105,7 @@ namespace Lucene.Net.Analysis.Util
         {
             base.Reset();
             wrapper.SetText(m_buffer, 0, 0);
-            iterator.SetText(new string(wrapper.Text, wrapper.Start, wrapper.Length));
+            iterator.SetText(wrapper);
             length = usableLength = m_offset = 0;
         }
 
@@ -176,7 +176,7 @@ namespace Lucene.Net.Analysis.Util
             }
 
             wrapper.SetText(m_buffer, 0, Math.Max(0, usableLength));
-            iterator.SetText(new string(wrapper.Text, wrapper.Start, wrapper.Length));
+            iterator.SetText(wrapper);
         }
 
         // TODO: refactor to a shared readFully somewhere