< Summary

Information
Class: NGql.Core.Pooling.CharArrayPool
Assembly: NGql.Core
File(s): /home/runner/work/NGql/NGql/src/Core/Pooling/CharArrayPool.cs
Line coverage
100%
Covered lines: 4
Uncovered lines: 0
Coverable lines: 4
Total lines: 17
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
Rent(...)100%11100%
Return(...)100%11100%
GetPooled(...)100%11100%

File(s)

/home/runner/work/NGql/NGql/src/Core/Pooling/CharArrayPool.cs

#LineLine coverage
 1using System.Buffers;
 2
 3namespace NGql.Core.Pooling;
 4
 5/// <summary>
 6/// Pool for char arrays to reduce allocations in span operations
 7/// </summary>
 8internal static class CharArrayPool
 9{
 310    private static readonly ArrayPool<char> Pool = ArrayPool<char>.Shared;
 11
 912    private static char[] Rent(int minimumLength) => Pool.Rent(minimumLength);
 13
 914    internal static void Return(char[] array, bool clearArray = false) => Pool.Return(array, clearArray);
 15
 916    internal static PooledCharArray GetPooled(int minimumLength) => new(Rent(minimumLength), minimumLength);
 17}