{"slug": "show-hn-codediff-fast-100ms-robust-99-95-syntax-aware-code-diff", "title": "Show HN: CodeDiff – Fast (<100ms), robust (99.95%) syntax-aware code diff", "summary": "Developer ivankovic released CodeDiff v0.1.1, an open-source syntax-aware code diff tool written in Rust that parses 24 languages with TreeSitter and falls back to a modified Myers line diffing algorithm for unparseable files. Tested on the last 50 commits of roughly 7,400 Gentoo package-list repositories, CodeDiff diffed 99.95% of file pairs in 120 seconds using 6GB of RAM on an 11-year-old Intel E3-1275 v5, with a median speed of 7ms and 93% of files diffed in under 100ms. On a hand-solved dataset of 1,400 diffs, CodeDiff was perfect on 70% and near-perfect on 90%, and perfect 89% of the time when measuring only the AST diff; the tool is licensed AGPL3.0 and targets p99 under 400ms and 99% perfect diffs across 30 languages for v1.0.", "body_md": "Hi folks!\n\nBecause of AI, there is more code to review. I don't know about you, but I get annoyed when the default git diff doesn't match something \"obvious\". I built CodeDiff to help.\n\nIt's a syntax-aware, careful implementation in Rust of all current research in code diffing. It parses 24 languages with TreeSitter and falls back to a modified Myers line diffing algorithm for any file it cannot parse. I wouldn't necessarily call it a novel algorithm, but it isn't a re-implementation of existing tools either.\n\nI tested it on the last 50 commits of all 7400-or-so repositories that are in the Gentoo package list. CodeDiff can diff 99.95% of those file pairs in 120s and 6GB of RAM on a rusty 11 year old Intel E3-1275 v5. The median speed is 7ms and 93% of files are diffed in under 100ms.\n\nI also did a bit of hand solving and have a test dataset of 1400 hand solved diffs. CodeDiff is perfect on 70% and near-perfect on 90% of them. But accuracy is actually a complex thing to measure, because if you are only after the AST diff, then it is perfect 89% of the time. Deciding what to paint however is not an objective thing so if you do try it out, check out the render options (press M) and make it fit your style.\n\nIf you just want to see how it looks like: [https://ivankovic.github.io/codediff/showcase/?case=python-r...](https://ivankovic.github.io/codediff/showcase/?case=python-refactoring&view=codediff)\n\nIf you want to install it: [https://github.com/ivankovic/codediff](https://github.com/ivankovic/codediff)\n\nDo feel free to file issues. It's v0.1.1 at the moment, but I have been using it for months as my git difftool and I plan to keep that stable. Using it as a library directly from Rust however, might change until v1.0. The final goal for v1.0 is p99 < 400ms and 99% perfect diff, including multi-file diff support in 30 languages.\n\nCredit where credit is due: There is a bunch of people researching diffs in the past 20 or so years. Without those papers, CodeDiff would be a lot harder to build. Especially without APTED and Myers algorithms.\n\nLicense: AGPL3.0, I kind of like copy-left. If your company prevents use of AGPL software tell them to throw a few bucks my way for my token usage and we can talk.\n\nAI disclosure: I use AI assisted coding. Claude and Mistral were used, heavily.\n\nComments URL: [https://news.ycombinator.com/item?id=49891989](https://news.ycombinator.com/item?id=49891989)\n\nPoints: 1\n\n# Comments: 0", "url": "https://wpnews.pro/news/show-hn-codediff-fast-100ms-robust-99-95-syntax-aware-code-diff", "canonical_source": "https://github.com/ivankovic/codediff", "published_at": "2026-09-29 12:22:44+00:00", "updated_at": "2026-09-29 12:47:53.237562+00:00", "lang": "en", "topics": ["developer-tools", "ai-tools"], "entities": ["CodeDiff", "ivankovic", "Rust", "TreeSitter", "Gentoo", "Intel E3-1275 v5", "Claude", "Mistral"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/show-hn-codediff-fast-100ms-robust-99-95-syntax-aware-code-diff", "markdown": "https://wpnews.pro/news/show-hn-codediff-fast-100ms-robust-99-95-syntax-aware-code-diff.md", "text": "https://wpnews.pro/news/show-hn-codediff-fast-100ms-robust-99-95-syntax-aware-code-diff.txt", "jsonld": "https://wpnews.pro/news/show-hn-codediff-fast-100ms-robust-99-95-syntax-aware-code-diff.jsonld"}}