优化SHA,未传入key时,仅对数据进行哈希,不做消息认证
智能大石头 authored at 2025-12-25 16:40:59
500.00 B
X
using BenchmarkDotNet.Attributes;
using NewLife.Collections;

namespace XUnitTest.Collections;

/// <summary>Pool 性能基准</summary>
[MemoryDiagnoser]
public class PoolBenchmark
{
    private Pool<Object> _pool;

    [GlobalSetup]
    public void Setup()
    {
        _pool = new Pool<Object>(128);
    }

    [Benchmark]
    public void GetReturn()
    {
        for (var i = 0; i < 100_000; i++)
        {
            var obj = _pool.Get();
            _pool.Return(obj);
        }
    }
}