Skip to content

Commit

Permalink
Lucene.Net.Util.Automaton.DacuikMihovAutomatonBuilder: Reduce the num…
Browse files Browse the repository at this point in the history
…ber of zero length array allocations (#295, #261)
  • Loading branch information
NightOwl888 committed Jun 30, 2020
1 parent 867834b commit 508389f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/Lucene.Net/Util/Automaton/DaciukMihovAutomatonBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,20 @@ public sealed class State // LUCENENET NOTE: Made public because it is returned
{
/// <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"/>.
Expand Down

0 comments on commit 508389f

Please sign in to comment.