{"id":50688154,"url":"https://github.com/rustyconover/memory-passing-speed-benchmark","last_synced_at":"2026-06-09T00:35:01.790Z","repository":{"id":362190690,"uuid":"1137656328","full_name":"rustyconover/memory-passing-speed-benchmark","owner":"rustyconover","description":null,"archived":false,"fork":false,"pushed_at":"2026-01-19T17:51:41.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-09T00:34:54.805Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rustyconover.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-19T16:51:17.000Z","updated_at":"2026-01-19T17:51:44.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/rustyconover/memory-passing-speed-benchmark","commit_stats":null,"previous_names":["rustyconover/memory-passing-speed-benchmark"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rustyconover/memory-passing-speed-benchmark","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustyconover%2Fmemory-passing-speed-benchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustyconover%2Fmemory-passing-speed-benchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustyconover%2Fmemory-passing-speed-benchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustyconover%2Fmemory-passing-speed-benchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rustyconover","download_url":"https://codeload.github.com/rustyconover/memory-passing-speed-benchmark/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustyconover%2Fmemory-passing-speed-benchmark/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34086664,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-09T00:35:01.082Z","updated_at":"2026-06-09T00:35:01.783Z","avatar_url":"https://github.com/rustyconover.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Memory-Passing IPC Benchmarks\n\nA performance benchmarking suite for comparing Inter-Process Communication (IPC) mechanisms on Unix-like systems. Measures throughput trade-offs between pipes and shared memory to identify crossover points where switching IPC methods becomes worthwhile.\n\n## Overview\n\nThis project benchmarks three IPC approaches:\n\n| Method | Description |\n|--------|-------------|\n| **Pipe** | Traditional Unix pipe with producer-consumer model |\n| **SHM Reused** | Single pre-allocated shared memory segment (best-case) |\n| **SHM Fresh** | New shared memory allocation per message (worst-case) |\n\n## Requirements\n\n- macOS or Linux\n- C compiler (gcc or clang)\n- Python 3.6+\n- matplotlib (for visualization)\n\n## Quick Start\n\n```bash\n# Build the benchmarks\nmake -C src\n\n# Run the benchmark suite\npython3 run_benchmarks.py\n\n# Analyze results\npython3 analyze.py results/\n```\n\n## Usage\n\n### Running Benchmarks\n\n```bash\n# Default run (1MB-512MB, 2000ms duration, 3 runs each)\npython3 run_benchmarks.py\n\n# Custom configuration\npython3 run_benchmarks.py --sizes 1048576 4194304 16777216 --duration 5000 --runs 5\n\n# Specific methods only\npython3 run_benchmarks.py --methods pipe shm_reused\n```\n\n### Running Individual Benchmarks\n\n```bash\n# Usage: \u003cbinary\u003e \u003csize_bytes\u003e \u003cduration_ms\u003e \u003crun_id\u003e\n./src/bench_pipe 4194304 2000 1      # 4MB messages for 2 seconds\n./src/bench_shm_reused 16777216 2000 1\n./src/bench_shm_fresh 1048576 2000 1\n```\n\n### Analyzing Results\n\n```bash\n# Generate report and visualization\npython3 analyze.py results/\n\n# Specify output path for chart\npython3 analyze.py results/ --output throughput_comparison.png\n```\n\n## Project Structure\n\n```\nmemory-passing/\n├── src/\n│   ├── bench_common.h      # Shared utilities, timing, validation\n│   ├── bench_pipe.c        # Pipe-based IPC benchmark\n│   ├── bench_shm_fresh.c   # Fresh SHM allocation per message\n│   ├── bench_shm_reused.c  # Reused SHM benchmark\n│   └── Makefile\n├── run_benchmarks.py       # Orchestrator script\n├── analyze.py              # Analysis and visualization\n└── results/                # Output CSV files\n```\n\n## How It Works\n\n### Benchmark Methodology\n\n1. **Warmup Phase** (500ms): Stabilizes CPU and caches\n2. **Measurement Phase**: Timed message passing with validation\n3. **Statistics**: Computes throughput, mean, stddev, percentiles\n\n### Message Validation\n\nEach message includes:\n- Magic number (`0xDEADBEEF`) for corruption detection\n- Sequence number for order verification\n- Timestamp for latency measurement\n\n### Platform-Specific Timing\n\n- **macOS**: `mach_absolute_time()` with timebase conversion\n- **Linux**: `clock_gettime(CLOCK_MONOTONIC)`\n\n## Output Format\n\nBenchmark results are written as CSV:\n\n```csv\nmethod,msg_size,messages_per_sec,mb_per_sec,run_id\npipe,1048576,2847.32,2847.32,1\nshm_reused,1048576,4521.18,4521.18,1\nshm_fresh,1048576,891.45,891.45,1\n```\n\n## Sample Results\n\nThe analysis identifies crossover points where shared memory outperforms pipes:\n\n```\n=== Crossover Analysis ===\nCrossover occurs between 4MB and 8MB\nAt sizes \u003e= 8MB, shared memory is more efficient\n\n=== Efficiency Ratio (SHM/Pipe) ===\n  1MB: 0.85x (pipe faster)\n  4MB: 0.97x (pipe faster)\n  8MB: 1.12x (shm faster)\n 16MB: 1.34x (shm faster)\n```\n\n## Building\n\n```bash\ncd src\nmake          # Build all benchmarks\nmake clean    # Remove binaries\n```\n\nThe Makefile handles platform differences automatically:\n- **macOS**: Uses standard POSIX SHM\n- **Linux**: Links `-lrt` and `-pthread`\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frustyconover%2Fmemory-passing-speed-benchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frustyconover%2Fmemory-passing-speed-benchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frustyconover%2Fmemory-passing-speed-benchmark/lists"}