similar

A dependency-free Rust diffing library with Myers, Patience, Histogram, and LCS algorithms

Library
Cargo
v3.2.0
1,310stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
68/100Good
Development Activity84
Maintenance44
Community44
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
76/100Good
Architecture80
Code Quality78
Innovation75
Learning Curve72

similar is a Rust crate that implements multiple diffing algorithms (Myers, Patience, Hunt-style, Histogram, and classic LCS) behind a single high-level API for comparing arbitrary sequences. It was originally inspired by pijul’s diff implementation and was built to power the insta snapshot testing library, but works equally well as a general-purpose diffing toolkit for text, byte, or custom sequence data.

The crate exposes both a low-level capture_diff/capture_diff_slices interface for diffing any indexable sequence, and a higher-level TextDiff type purpose-built for text: line, word, character, and grapheme-level diffing, unified diff generation, and inline change highlighting. It supports no_std + alloc environments via optional hashbrown/bstr backends, making it usable outside of a standard host environment.

What You Get

  • Multiple diff algorithm implementations (Myers, Patience, Hunt-style, Histogram, classic LCS table) selectable via a single Algorithm enum
  • A high-level TextDiff API for line, word, character, and grapheme-level text comparison
  • Unified diff generation (udiff module) compatible with standard patch/diff tooling
  • Inline change highlighting for rendering fine-grained word/character differences within a changed line
  • no_std + alloc support with pluggable hashbrown/bstr backends for embedded or constrained environments
  • Generic sequence diffing via capture_diff/capture_diff_slices for any indexable, non-text data

Common Use Cases

  • Powering snapshot-testing tools that need to show human-readable diffs between expected and actual output (its original use case in insta)
  • Generating unified diffs for CLI tools, patch utilities, or code-review tooling
  • Building custom diff/merge views in editors or terminal UIs with word- or character-level highlighting
  • Comparing arbitrary structured sequences (not just text) in data-processing or testing pipelines

Under The Hood

Architecture - similar is organized around a low-level algorithms module that implements each diff algorithm (Myers in myers.rs, Patience in patience.rs, Histogram in histogram.rs, Hunt-style in hunt.rs, and classic LCS in lcs.rs) behind a shared capture_diff/capture_diff_slices entry point that operates on any indexable sequence via a CachedLookup abstraction (lookup.rs). Text-specific functionality sits in the text module, where TextDiff (abstraction.rs) wraps the generic algorithms with tokenization for line/word/character/grapheme granularity, and InlineChange (inline.rs) layers word-level highlighting on top of a line-level diff. udiff.rs renders DiffOp sequences produced by the core algorithms into standard unified-diff text. Tech Stack - the crate has zero mandatory dependencies; optional features add unicode-segmentation for grapheme-aware splitting, bstr for byte-string handling, hashbrown/web-time for no_std + alloc targets, and serde for serializing diff ops. Dev-dependencies (insta, criterion) show the crate dogfoods its own downstream consumer (insta) for its test suite and benchmarks. Code Quality - tests are implemented as snapshot tests via insta, with committed .snap files under src/snapshots/ and src/text/snapshots/ covering unified-diff output and text-diff behavior; there is no separate tests/ integration directory, so most correctness checking happens through these snapshots plus the benches/diffs.rs Criterion benchmark. Code is split into small, single-responsibility files per algorithm rather than one large module, aiding readability. API Design - the public surface favors a small number of top-level entry points (TextDiff::from_lines, capture_diff_slices, Algorithm enum) with sensible defaults (Myers algorithm, line-terminated diffing) so a consumer can get a working unified diff in under 10 lines, while lower-level access to DiffOps remains available for callers that need custom rendering.

Used by 8 apps in this directory

Dart
74%
AGPL 3.0

AppFlowy

Productivity · Project Management · Collaboration

75,729

The open-source AI workspace that puts your data, your rules — with local LLMs, CRDT collaboration, and full self-hosting built in.

View details
66
Repo Health
81
Technical
66
Dependency
Built with
Dart74%
Rust24%
Updated 1 weeks ago
TypeScript
69%
Apache 2.0

Laminar

AI Development · Monitoring

3,180

Open-source observability platform purpose-built for AI agents — trace, evaluate, debug, and monitor at scale with SQL access and real-time replay.

View details
85
Repo Health
76
Technical
70
Dependency
Built with
TypeScript69%
Rust29%
Updated yesterday
Rust
72%
MIT

monty

AI Development · Developer Tools

8,079

Run LLM-generated Python code safely inside your agent—no containers, no CPython, no compromise—with sub-microsecond startup.

View details
87
Repo Health
83
Technical
73
Dependency
Built with
Rust72%
Python23%
Updated yesterday
Go
80%
AGPL 3.0

PeerDB

Data Engineering · Databases

3,241

Postgres-native ETL that streams change data capture in real time to Snowflake, BigQuery, ClickHouse, S3, and Kafka — up to 10x faster than general-purpose pipelines, managed through a familiar Postgres SQL interface.

View details
88
Repo Health
76
Technical
68
Dependency
Built with
Go80%
TypeScript13%
Updated today
Python
55%
Other

PostHog

Analytics · Monitoring · Developer Tools

37,777

The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.

View details
92
Repo Health
80
Technical
67
Dependency
Built with
Python55%
TypeScript36%
Updated today
Java
92%
Apache 2.0

QuestDB

Databases · Analytics

17,263

A high-performance, open-source time-series database built for financial market data, IoT telemetry, and real-time analytics, combining a zero-GC Java/C++ core with SIMD-accelerated SQL and a WAL-to-Parquet storage engine.

View details
91
Repo Health
86
Technical
70
Dependency
Built with
Java92%
Updated today
Rust
50%
Apache 2.0

Vibe Kanban

AI Agents · AI Code Assistants · Project Management

27,849

A kanban board for planning work and dispatching Claude Code, Codex, Gemini CLI, and eight other coding agents into isolated git worktrees, then reviewing and merging their diffs from one UI.

View details
53
Repo Health
75
Technical
65
Dependency
Built with
Rust50%
TypeScript46%
Updated 3 months ago
Rust
97%
Other

Zed

Developer Tools · Collaboration · Code Editors

88,861

High-performance, multiplayer code editor built in Rust by the creators of Atom and Tree-sitter, with native AI integration and real-time collaboration.

View details
94
Repo Health
88
Technical
73
Dependency
Built with
Rust97%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search