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 2020/06/30 21:50:46 UTC
[lucenenet] 10/27:
Lucene.Net.Util.Automaton.DacuikMihovAutomatonBuilder: Reduce the number of
zero length array allocations (#295, #261)
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 508389f6ad3478c04482debbbd0f454e0fa16a60
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sun Jun 28 22:50:21 2020 +0700
Lucene.Net.Util.Automaton.DacuikMihovAutomatonBuilder: Reduce the number of zero length array allocations (#295, #261)
---
.../Util/Automaton/DaciukMihovAutomatonBuilder.cs | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/Lucene.Net/Util/Automaton/DaciukMihovAutomatonBuilder.cs b/src/Lucene.Net/Util/Automaton/DaciukMihovAutomatonBuilder.cs
index 7ff1a6a..166c58e 100644
--- a/src/Lucene.Net/Util/Automaton/DaciukMihovAutomatonBuilder.cs
+++ b/src/Lucene.Net/Util/Automaton/DaciukMihovAutomatonBuilder.cs
@@ -42,11 +42,20 @@ namespace Lucene.Net.Util.Automaton
{
/// <summary>
/// An empty set of labels. </summary>
- private static readonly int[] NO_LABELS = new int[0];
-
+ private static readonly int[] NO_LABELS =
+#if FEATURE_ARRAYEMPTY
+ Array.Empty<int>();
+#else
+ new int[0];
+#endif
/// <summary>
/// An empty set of states. </summary>
- private static readonly State[] NO_STATES = new State[0];
+ private static readonly State[] NO_STATES =
+#if FEATURE_ARRAYEMPTY
+ Array.Empty<State>();
+#else
+ new State[0];
+#endif
/// <summary>
/// Labels of outgoing transitions. Indexed identically to <see cref="states"/>.