Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vertexclique/cuneiform-fields
Field level cache optimizations for Rust (no_std)
https://github.com/vertexclique/cuneiform-fields
cache-coherence cache-optimization concurrency data-structures field-optimization no-std rust-lang
Last synced: 3 months ago
JSON representation
Field level cache optimizations for Rust (no_std)
- Host: GitHub
- URL: https://github.com/vertexclique/cuneiform-fields
- Owner: vertexclique
- License: apache-2.0
- Created: 2019-12-29T19:42:17.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-02-03T21:24:26.000Z (almost 4 years ago)
- Last Synced: 2024-10-07T18:08:53.806Z (3 months ago)
- Topics: cache-coherence, cache-optimization, concurrency, data-structures, field-optimization, no-std, rust-lang
- Language: Rust
- Homepage: https://docs.rs/cuneiform-fields
- Size: 2 MB
- Stars: 7
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
Field level cache optimizations for Rust (no_std)
[![Build Status](https://github.com/vertexclique/cuneiform-fields/workflows/CI/badge.svg)](https://github.com/vertexclique/cuneiform-fields/actions)
[![Latest Version](https://img.shields.io/crates/v/cuneiform-fields.svg)](https://crates.io/crates/cuneiform-fields)
[![Rust Documentation](https://img.shields.io/badge/api-rustdoc-blue.svg)](https://docs.rs/cuneiform-fields/)This crate provides cache line size fitting optimizations to fields in structs.
This crate aligns fields with `#[repr(align(COHERENCE_LINE_SIZE))]` to decrease the time between prefetch signals for data.
`COHERENCE_LINE_SIZE` can be detected or decided based on the architecture by `cuneiform` itself.```toml
[dependencies]
cuneiform-fields = "0.1"
```## Examples
#### Hermetic aligned fields
Align by hermetic cache line size detection mentioned in [cuneiform readme](https://github.com/vertexclique/cuneiform#----):
```rust
use cuneiform_fields::prelude::*;pub struct Hermetic {
data: HermeticPadding,
data_2: u16,
}
```
In the example above `data` will be aligned by hermetic alignment but field `data_2` isn't going to be alignment optimized.#### Architecture aligned fields
Align by cache line size detected by current Rust compiler architecture.
If architecture isn't detected in known architectures it will fall back to default alignment:
```rust
use cuneiform_fields::prelude::*;pub struct ArchSpecific {
data: ArchPadding,
data_2: u16,
}
```
In the example above `data` will be aligned by architecture alignment but field `data_2` isn't going to be alignment optimized.**NOTE:** Alignment values are not randomly chosen or incorporated directly.
Values are considered and incorporated inside with the mindset of preventing false sharing
or creating less warp points in exclusive caching.For design choices, architecture and board systems and more information. Please visit [Cuneiform GitHub](https://github.com/vertexclique/cuneiform).