# LangChain vs LlamaIndex: source lines of code compared

The LangChain vs LlamaIndex comparison on OctoCounts shows side-by-side source line counts for langchain-ai/langchain and run-llama/llama_index, counted with the same engine and analysis options on the dates shown in the methodology line: files, total lines, code lines, comment lines, blank lines, and per-language totals, pinned to the exact commits listed below.

As of 2026-09-15, langchain-ai/langchain contains 245,486 total lines (201,005 code) across 1,900 files, while run-llama/llama_index contains 403,120 total lines (308,785 code) across 4,446 files as of 2026-09-15. run-llama/llama_index is about 1.5x the size of langchain-ai/langchain by code lines. Code size is not code quality: a larger count only means more source material, not a better or worse project.

| Metric | [langchain-ai/langchain](https://octocounts.com/github/langchain-ai/langchain) | [run-llama/llama_index](https://octocounts.com/github/run-llama/llama_index) |
| --- | ---: | ---: |
| Files | 1,900 | 4,446 |
| Total lines | 245,486 | 403,120 |
| Code lines | 201,005 | 308,785 |
| Comment lines | 14,995 | 33,622 |
| Blank lines | 29,486 | 60,713 |
| Languages counted | 9 | 12 |

Top languages in langchain-ai/langchain: Python (97.8% of code), TOML (1.4% of code), Makefile (0.6% of code). Top languages in run-llama/llama_index: Python (84.2% of code), TOML (11.7% of code), Makefile (2.3% of code). Python, TOML, Makefile appear in both top language lists; Shell, XSL appear only in langchain-ai/langchain's top languages; Jupyter Notebooks, JavaScript appear only in run-llama/llama_index's top languages.

Methodology: both counts come from cached OctoCounts reports generated with tokei. langchain-ai/langchain was counted at ref 8831544aeebf2eed4f2d4a80e2b963a62a93f25d (commit 8831544aeebf) on 2026-09-15; run-llama/llama_index was counted at ref 0f43c00baa2f68970cb86a732aefd59f1e6fbee7 (commit 0f43c00baa2f) on 2026-09-15. See the [counting methodology](https://octocounts.com/docs/methodology) for ignored directories and analysis options.
## About this comparison

langchain-ai/langchain counts the LangChain monorepo: Python and JavaScript/TypeScript packages for the framework, plus documentation and cookbook examples. run-llama/llama_index counts the LlamaIndex monorepo: the Python core, integration packages, and the TypeScript library in one tree. Both are integration-heavy LLM application frameworks, counted with the same engine on the dates above.

Both per-language tables are polyglot — Python alongside TypeScript on each side — because each project maintains parallel library code for the two ecosystems in a single repository.

A large share of each tree is integration packages connecting to third-party model, vector-store, and data providers; that share grows with ecosystem breadth rather than with the size of either framework's core, so the totals substantially count connector surface.

_Repository size here mostly tracks how many external providers each framework integrates with, not the power of its core abstractions — and neither total measures retrieval quality, latency, or cost for your application._

Sources: [langchain-ai/langchain repository (Python and JS/TS monorepo)](https://github.com/langchain-ai/langchain) · [run-llama/llama_index repository (Python core and integrations)](https://github.com/run-llama/llama_index). Statements verified 2026-09-16.

Evidence and next steps:

- [langchain-ai/langchain SLOC report](https://octocounts.com/github/langchain-ai/langchain)
- [run-llama/llama_index SLOC report](https://octocounts.com/github/run-llama/llama_index)
- [Compare langchain-ai/langchain and run-llama/llama_index interactively](https://octocounts.com/compare?left=https%3A%2F%2Fgithub.com%2Flangchain-ai%2Flangchain&right=https%3A%2F%2Fgithub.com%2Frun-llama%2Fllama_index)

Note: code size is not code quality. OctoCounts only reports reproducible line counts and makes no claim that either project is better.

## Compare FAQ

### Which has more lines of code, langchain-ai/langchain or run-llama/llama_index?

run-llama/llama_index has more code: 308,785 code lines versus 201,005 for langchain-ai/langchain, about 1.5x as much, based on cached OctoCounts reports as of 2026-09-15.

### Does more source lines of code mean more complexity?

Not necessarily. SLOC measures size, not complexity, quality, or maintainability. A larger codebase can mean more features, more generated or vendored code, more verbose language idioms, or more tests — none of which imply the code is harder to work with. Use SLOC to gauge the scale of what you'd be reading or maintaining, not as a quality signal for langchain-ai/langchain, run-llama/llama_index, or any repository.

### How is this comparison calculated?

Methodology: both counts come from cached OctoCounts reports generated with tokei. langchain-ai/langchain was counted at ref 8831544aeebf2eed4f2d4a80e2b963a62a93f25d (commit 8831544aeebf) on 2026-09-15; run-llama/llama_index was counted at ref 0f43c00baa2f68970cb86a732aefd59f1e6fbee7 (commit 0f43c00baa2f) on 2026-09-15. See the counting methodology for ignored directories and analysis options.

### Can I compare a different branch, tag, or commit?

Yes. This page shows the default branch for each repository. Use the interactive comparison tool to pick any public GitHub repository, branch, tag, or commit SHA for both sides and get a fresh side-by-side report.

## Related OctoCounts pages

- [Interactive repository comparison](https://octocounts.com/compare)
- [Recently analyzed repositories](https://octocounts.com/recent)
- [Popular SLOC reports](https://octocounts.com/popular)
- [Trending GitHub repositories](https://octocounts.com/trending)
- [Hall of Monoliths](https://octocounts.com/hall-of-monoliths)
- [Original research: how filtering changes SLOC counts](https://octocounts.com/research)
- [GitHub SLOC counter guide](https://octocounts.com/docs/github-sloc-counter)
- [Counting methodology](https://octocounts.com/docs/methodology)
- [SLOC and code metrics glossary](https://octocounts.com/docs/glossary)
- [OctoCounts API docs](https://octocounts.com/docs/api)
