Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/esotuvaka/memetic
Memetic is a CLI tool for multi-language memory layout analysis. It can recursively search your directories for structs, suggest optimizations, and implement them. Useful for memory constrained, high-performance apps, embedded programming, FFI interoperability, etc.
https://github.com/esotuvaka/memetic
c cli cpp embedded-systems ffi go memory-analyzer rust struct
Last synced: 10 days ago
JSON representation
Memetic is a CLI tool for multi-language memory layout analysis. It can recursively search your directories for structs, suggest optimizations, and implement them. Useful for memory constrained, high-performance apps, embedded programming, FFI interoperability, etc.
- Host: GitHub
- URL: https://github.com/esotuvaka/memetic
- Owner: esotuvaka
- License: mit
- Created: 2024-12-23T08:48:37.000Z (19 days ago)
- Default Branch: main
- Last Pushed: 2024-12-25T08:27:15.000Z (17 days ago)
- Last Synced: 2024-12-25T09:25:03.236Z (17 days ago)
- Topics: c, cli, cpp, embedded-systems, ffi, go, memory-analyzer, rust, struct
- Language: Rust
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
# Memetic
Memetic is a Rust CLI tool designed to read source code files, find the structs, analyze their memory layout, and suggest optimizations for a more optimal memory footprint. It provides a formatted output or a git diff to show the suggested changes.
## Features
- **Recursive File Search**: Search for source code files starting from the directory the CLI is called in.
- **Struct Analysis**: Identify and analyze the memory layout of structs in the source code.
- **Optimization Suggestions**: Suggest a more optimal memory footprint for the structs, if any.
- **Formatted Output**: Display the optimized memory layout in a readable format.
- **Git Diff**: Show the suggested changes as a git diff.## Installation
NOTE: Currently no full release yet, so will have to be built from source.
To install `memetic`, you need to have Rust and Cargo installed. Then, you can build the project using Cargo:
```sh
cargo build --release
```## Usage
Run `memetic` with the following command:
```sh
memetic [OPTIONS]
```### Options
- -m mode: (E)xecute, (S)uggest, (D)iff using Git
- -o override: Pass a json object that overrides defaults. e.g: {"type": "u32", "nat_align": 5, "size": 8}
- -i includes: operate on files matching a comma separated list of regex patterns, instead of recursively
- -e excludes: exclude files matching a comma separated list of regex patterns from recursive search
- -d directory: operate from some starting directory, given some relative path to it. e.g: "./src"
## Examples
To analyze all files in the current directory and suggest optimizations:
```sh
memetic -a -m suggest
```To auto implement changes over a nested directory, excluding 2 files:
```sh
memetic -m execute -d ./src/routers -e users.rs,messages.rs # note the lack of space between files
```## Contributing
Contributions are welcome! Please open an issue or submit a pull request on GitHub.