apache / apache/kvrocks

Rethink `USE_ALIGNED_ACCESS` macro in kvrocks code

Open
#2,261 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C++
Stars
4.4k
Forks
658
Avg merge
1d 20h
Merged PRs (30d)
10

Description

### Search before asking

- [X] I had searched in the [issues](https://github.com/apache/kvrocks/issues) and found no similar issues.

### Motivation

Redis uses `USE_ALIGNED_ACCESS` and check memory aligned in it's code:
1. For archs like ARM, memory access should be "aligned".
2. For arch like x86, it can use some code to do optimizations

This code leaves lots of ad-hoc optimizations in kvrocks. I think we need to check our compiler supports, does this really provides any optimizations

### Solution

1. Checks `USE_ALIGNED_ACCESS` in code with compiler versions
2. Remove them if no really optimizations

### Are you willing to submit a PR?

- [X] I'm willing to submit a PR!

Contributor guide

No contributing guide indexed for this repository

Research direction

No files, tests, or entry points are named. Search the codebase for USE_ALIGNED_ACCESS, then inspect the compiler-version checks and the related alignment or optimization paths. Done means determining whether each conditional provides a real supported optimization and removing or retaining the ad-hoc checks accordingly.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, redis
Domain
databases, performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.