4paradigm / 4paradigm/OpenMLDB

Optimize AggrBuffer memory layout

Đang mở
#1,578 0 bình luận 0 reaction 1 người được giao Được @nautaa nhận Xem trên GitHub
Ngôn ngữ chính
C++
Star
1.7k
Fork
331
Merge trung bình
12 ngày 12 giờ
Pull request đã merge (30 ngày)
1

Mô tả

**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`

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
cpp
Lĩnh vực
databases, performance
Loại issue
Tái cấu trúc
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.