4paradigm / 4paradigm/OpenMLDB

Optimize AggrBuffer memory layout

未关闭
#1,578 0 条评论 0 个 reaction 已指派 1 人 已被 @nautaa 认领 在 GitHub 查看
主要语言
C++
星标
1.7k
派生
331
平均合并
12 天 12 小时
30 天内合并 PR
1

描述

**Describe the feature you'd like**

Now `AggrBuffer` is defined as follows:

```
union AggrVal {
int16_t vsmallint;
int32_t vint;
int64_t vlong;
float vfloat;
double vdouble;
};

struct AggrBuffer {
AggrVal aggr_val_;
int64_t ts_begin_;
int64_t ts_end_;
int32_t aggr_cnt_;
uint64_t binlog_offset_;
AggrBuffer() : aggr_val_(), ts_begin_(-1), ts_end_(0), aggr_cnt_(0), binlog_offset_(0) {}
void clear() {
memset(&aggr_val_, 0, sizeof(aggr_val_));
ts_begin_ = -1;
ts_end_ = 0;
aggr_cnt_ = 0;
binlog_offset_ = 0;
}
};
struct AggrBufferLocked {
std::unique_ptr mu_;
AggrBuffer buffer_;
}
```

Can use a more efficient way to do it.

**Additional context**
`src/storage/aggregator.h`

贡献指南

打开贡献指南

调研方向

The issue points to src/storage/aggregator.h where AggrBuffer is defined. Start by examining the current memory layout and understanding how AggrBuffer is used in the codebase. Look for opportunities to reduce padding or reorder fields for better cache efficiency. Check if there are any benchmarks or tests related to aggregation performance to validate changes. Ensure the new layout maintains the same semantics and that all usages are updated accordingly.

由索引模型根据 Issue 内容生成。

评估

技术栈
cpp
领域
databases, performance
Issue 类型
重构
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。