dc0adb533d
* PPTC & Pool Enhancements.
* Avoid buffer allocations in CodeGenContext.GetCode(). Avoid stream allocations in PTC.PtcInfo.
Refactoring/nits.
* Use XXHash128, for Ptc.Load & Ptc.Save, x10 faster than Md5.
* Why not a nice Span.
* Added a simple PtcFormatter library for deserialization/serialization, which does not require reflection, in use at PtcJumpTable and PtcProfiler; improves maintainability and simplicity/readability of affected code.
* Nits.
* Revert #1987.
* Revert "Revert #1987."
This reverts commit 998be765cf
.
33 lines
810 B
C#
33 lines
810 B
C#
namespace ARMeilleure.Common
|
|
{
|
|
static class BitMapPool
|
|
{
|
|
public static BitMap Allocate(int initialCapacity)
|
|
{
|
|
return BitMap().Reset(initialCapacity);
|
|
}
|
|
|
|
#region "ThreadStaticPool"
|
|
public static void PrepareBitMapPool(int groupId = 0)
|
|
{
|
|
ThreadStaticPool<BitMap>.PreparePool(groupId, ChunkSizeLimit.Small);
|
|
}
|
|
|
|
private static BitMap BitMap()
|
|
{
|
|
return ThreadStaticPool<BitMap>.Instance.Allocate();
|
|
}
|
|
|
|
public static void ResetBitMapPool(int groupId = 0)
|
|
{
|
|
ThreadStaticPool<BitMap>.ResetPool(groupId);
|
|
}
|
|
|
|
public static void DisposeBitMapPools()
|
|
{
|
|
ThreadStaticPool<BitMap>.DisposePools();
|
|
}
|
|
#endregion
|
|
}
|
|
}
|