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 3e63d15292a014924971dd47bb338a708a0c4a42
Author: Shad Storhaug <[email protected]>
AuthorDate: Thu Oct 27 01:37:29 2022 +0700

    PERFORMANCE: Lucene.Net.Analysis.Ja.GraphvizFormatter: Removed unnecessary 
surfaceForm string allocation.
---
 src/Lucene.Net.Analysis.Kuromoji/GraphvizFormatter.cs | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/Lucene.Net.Analysis.Kuromoji/GraphvizFormatter.cs 
b/src/Lucene.Net.Analysis.Kuromoji/GraphvizFormatter.cs
index 508c924ab..487d6adf7 100644
--- a/src/Lucene.Net.Analysis.Kuromoji/GraphvizFormatter.cs
+++ b/src/Lucene.Net.Analysis.Kuromoji/GraphvizFormatter.cs
@@ -151,12 +151,11 @@ namespace Lucene.Net.Analysis.Ja
                     int bgCost = 
costs.Get(backPosData.lastRightID[posData.backIndex[idx]],
                                                  
dict.GetLeftId(posData.backID[idx]));
 
-                    string surfaceForm = new string(fragment,
-                                                          posData.backPos[idx] 
- startPos,
-                                                          pos - 
posData.backPos[idx]);
+                    // LUCENENET: Removed unnecessary surfaceForm allocation 
and appended
+                    // the chars directly to the StringBuilder below.
 
                     sb.Append(" [label=\"");
-                    sb.Append(surfaceForm);
+                    sb.Append(fragment, posData.backPos[idx] - startPos, pos - 
posData.backPos[idx]); 
                     sb.Append(' ');
                     sb.Append(wordCost);
                     if (bgCost >= 0)

Reply via email to