Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RavenDB-22088 - Reduce the heap allocations #68

Open
wants to merge 1 commit into
base: ravendb/v5.4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Lucene.Net/Index/AbstractAllTermDocs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public bool Next(IState state)
return SkipTo(internalDoc + 1, state);
}

public int Read(int[] docs, int[] freqs, IState state)
public int Read(Span<int> docs, Span<int> freqs, IState state)
{
int length = docs.Length;
int i = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/Lucene.Net/Index/DirectoryReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1394,7 +1394,7 @@ public virtual bool Next(IState state)
}

/// <summary>Optimized implementation. </summary>
public virtual int Read(int[] docs, int[] freqs, IState state)
public virtual int Read(Span<int> docs, Span<int> freqs, IState state)
{
while (true)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Lucene.Net/Index/FilterIndexReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public virtual bool Next(IState state)
{
return in_Renamed.Next(state);
}
public virtual int Read(int[] docs, int[] freqs, IState state)
public virtual int Read(Span<int> docs, Span<int> freqs, IState state)
{
return in_Renamed.Read(docs, freqs, state);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Lucene.Net/Index/MultipleTermPositions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public virtual void Seek(TermEnum termEnum, IState state)

/// <summary> Not implemented.</summary>
/// <throws> UnsupportedOperationException </throws>
public virtual int Read(int[] arg0, int[] arg1, IState state)
public virtual int Read(Span<int> arg0, Span<int> arg1, IState state)
{
throw new System.NotSupportedException();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Lucene.Net/Index/ParallelReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ public virtual bool Next(IState state)
return termDocs.Next(state);
}

public virtual int Read(int[] docs, int[] freqs, IState state)
public virtual int Read(Span<int> docs, Span<int> freqs, IState state)
{
if (termDocs == null)
return 0;
Expand Down
4 changes: 2 additions & 2 deletions src/Lucene.Net/Index/SegmentTermDocs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public virtual bool Next(IState state)
}

/// <summary>Optimized implementation. </summary>
public virtual int Read(int[] docs, int[] freqs, IState state)
public virtual int Read(Span<int> docs, Span<int> freqs, IState state)
{
int length = docs.Length;
if (currentFieldOmitTermFreqAndPositions)
Expand Down Expand Up @@ -216,7 +216,7 @@ public virtual int Read(int[] docs, int[] freqs, IState state)
}
}

private int ReadNoTf(int[] docs, int[] freqs, int length, IState state)
private int ReadNoTf(Span<int> docs, Span<int> freqs, int length, IState state)
{
int i = 0;
while (i < length && count < df)
Expand Down
2 changes: 1 addition & 1 deletion src/Lucene.Net/Index/SegmentTermPositions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public override bool Next(IState state)
return false;
}

public override int Read(int[] docs, int[] freqs, IState state)
public override int Read(Span<int> docs, Span<int> freqs, IState state)
{
throw new System.NotSupportedException("TermPositions does not support processing multiple documents in one call. Use TermDocs instead.");
}
Expand Down
2 changes: 1 addition & 1 deletion src/Lucene.Net/Index/TermDocs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public interface TermDocs : IDisposable
/// <p/>Returns the number of entries read. Zero is only returned when the
/// stream has been exhausted.
/// </summary>
int Read(int[] docs, int[] freqs, IState state);
int Read(Span<int> docs, Span<int> freqs, IState state);

/// <summary>Skips entries to the first beyond the current whose document number is
/// greater than or equal to <i>target</i>. <p/>Returns true iff there is such
Expand Down
5 changes: 3 additions & 2 deletions src/Lucene.Net/Search/MultiTermQueryWrapperFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ public override DocIdSet GetDocIdSet(IndexReader reader, IState state)
return DocIdSet.EMPTY_DOCIDSET;
// else fill into an OpenBitSet
OpenBitSet bitSet = new OpenBitSet(reader.MaxDoc);
int[] docs = new int[32];
int[] freqs = new int[32];
Span<int> docs = stackalloc int[32];
Span<int> freqs = stackalloc int[32];

TermDocs termDocs = reader.TermDocs(state);
try
{
Expand Down
Loading