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/11/21 05:03:05 UTC
[lucenenet] 04/05: PERFORMANCE: Lucene.Net.Support.Arrays::CopyOfRange(): Use the Copy() method rather than a for loop for a ~10x improvement in performance.
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 36da622f9dce2695e77642a6ebb7f1882ff6ceb4
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sun Nov 20 16:42:29 2022 +0700
PERFORMANCE: Lucene.Net.Support.Arrays::CopyOfRange(): Use the Copy() method rather than a for loop for a ~10x improvement in performance.
---
src/Lucene.Net/Support/Arrays.cs | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/src/Lucene.Net/Support/Arrays.cs b/src/Lucene.Net/Support/Arrays.cs
index e5887ed7b..a13270e46 100644
--- a/src/Lucene.Net/Support/Arrays.cs
+++ b/src/Lucene.Net/Support/Arrays.cs
@@ -589,12 +589,7 @@ namespace Lucene.Net.Support
{
int newLength = endIndexExc - startIndexInc;
T[] newArray = new T[newLength];
-
- for (int i = startIndexInc, j = 0; i < endIndexExc; i++, j++)
- {
- newArray[j] = original[i];
- }
-
+ Copy(original, startIndexInc, newArray, 0, newLength);
return newArray;
}