matrixorigin / matrixorigin/matrixone

[Performance]: optimize memory allocations

Open
#23,846 0 comments 0 reactions 1 assignee Claimed by @aunjgr View on GitHub
area/memory area/performance Enhancement kind/enhancement level/challenging
Dominant language
Go
Stars
1.9k
Forks
311
Avg merge
1d 3h
Merged PRs (30d)
768

Description

### Is there an existing issue for performance?

- [x] I have checked the existing issues.

### Environment

```Markdown
- Version or commit-id (e.g. v0.1.0 or 8b23a93):
- Hardware parameters:
- OS type:
- Others:
```

### Details of Performance

Reducing memory allocation improves application performance by decreasing CPU usage, minimizing garbage collection (GC) overhead, and enhancing cache efficiency. It leads to lower latency, reduced memory footprints, and lower operational costs in cloud environments. Fewer allocations reduce the sawtooth memory pattern, preventing frequent GC pauses that slow down performance.

Key Benefits of Reducing Memory Allocation:

- Improved Performance (Lower CPU Usage): Allocating memory, particularly in garbage-collected languages, takes time. Fewer allocations mean less CPU time is spent managing memory.
- Reduced Garbage Collection (GC) Pressure: When fewer temporary objects are created, the GC runs less often, resulting in fewer pauses and more consistent application execution time.
- Better Cache Utilization: Reusing existing memory rather than creating new objects improves data locality, allowing data to fit better in CPU caches, which boosts performance.
- Reduced Memory Footprint: Less allocated memory results in smaller memory usage, which is essential for resource-constrained environments.
- Lower Operating Costs: For cloud applications, reduced memory usage can lead to cost savings on infrastructure.
- Increased Predictability: Frequent allocations can trigger unpredictable garbage collection cycles. Reducing them leads to more stable and predictable performance.

### Additional information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.