lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [23/27] lucenenet git commit: Lucene.Net.Core.Codecs.Lucene45.Lucene45DocValuesConsumer: changed from .ToArray() to .CopyTo() for better efficiency
Date Sun, 05 Feb 2017 16:51:58 GMT
Lucene.Net.Core.Codecs.Lucene45.Lucene45DocValuesConsumer: changed from .ToArray() to .CopyTo()
for better efficiency


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/0c711c82
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/0c711c82
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/0c711c82

Branch: refs/heads/api-work
Commit: 0c711c82dbb07f6361226d9166c3d10bca3d6ed2
Parents: 3ec3e79
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Sun Feb 5 18:35:06 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Sun Feb 5 18:35:06 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Codecs/Lucene45/Lucene45DocValuesConsumer.cs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0c711c82/src/Lucene.Net.Core/Codecs/Lucene45/Lucene45DocValuesConsumer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene45/Lucene45DocValuesConsumer.cs b/src/Lucene.Net.Core/Codecs/Lucene45/Lucene45DocValuesConsumer.cs
index 9c151ba..5ae2379 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene45/Lucene45DocValuesConsumer.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene45/Lucene45DocValuesConsumer.cs
@@ -236,7 +236,9 @@ namespace Lucene.Net.Codecs.Lucene45
                     break;
 
                 case TABLE_COMPRESSED:
-                    long[] decode = uniqueValues.ToArray();//LUCENE TO-DO Hadd oparamerter
before
+                    // LUCENENET NOTE: diming an array and then using .CopyTo() for better
efficiency than LINQ .ToArray()
+                    long[] decode = new long[uniqueValues.Count];
+                    uniqueValues.CopyTo(decode, 0);
                     Dictionary<long, int> encode = new Dictionary<long, int>();
                     meta.WriteVInt(decode.Length);
                     for (int i = 0; i < decode.Length; i++)


Mime
View raw message