Daily update on 20260307-020120 by Nitload Youmu. Additional Message : None

Signed-off-by: Nitload <YoumuLiu_NSI@whv0t.onmicrosoft.com>
This commit is contained in:
Nitload
2026-03-07 02:01:20 +08:00
parent 405f895e29
commit 64360b63a1
4 changed files with 475 additions and 192 deletions
@@ -0,0 +1,59 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="L4"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Collections;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.HighPerformance.Memory
{
public unsafe class L4
{
private readonly byte* _buffer;
private readonly SwissTable _map;
public nint MapMemory(nint address)
{
if (_map.TryGet(address, out nint ptr))
{
return ptr;
} else
{
/*
* register a request for memory mapping,
* and return a pointer to the mapped memory.
*/
return 0;
}
}
}
}
@@ -77,8 +77,8 @@ L4 缓存器是一个纯软件实现的**线程本地数据缓存层**,
| 参数 | 值 | 说明 |
|-------------------|-----------------------|-----------------------------------|
| 缓存区总容量 | 5-10 MB | 线程本地连续内存 |
| 缓存行大小 | 1024 Bytes | = 8 个 `double MAT_KERNEL` 的大小 |
| 映射表类型 | Swiss Table | 1024 桶 × 256 槽,SIMD 加速 |
| 缓存行大小 | 8192 Bytes | = 64 个 `double MAT_KERNEL` 的大小 |
| 映射表类型 | Swiss Table | 65536 桶 × 16 槽,SIMD 加速 |
| 缓存行存储池 | Slab Allocator | 非并发、固定容量、不自动扩容 |
| 逐出策略 | 4 级热度环形链表 | 基于访问频率的近似 LFU |
| 写回策略 | 无(只读缓存) | 逐出时直接丢弃,不写回远端 |