Skip to content

nchhillar2004/cstat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CSTAT 📈

super fast code stats.

a simple tool to count lines, detect languages, and scan big codebases fast.

Warning

development moved to - cstat-v2


⁉️ Why this exists

most tools are either slow or heavy.
this one is built to be fast and lightweight.

  • ⚡ faster than tokei
  • 🧠 low cpu + memory usage
  • 📂 scans huge folders in seconds
  • 🌍 120+ languages, 250+ extensions

🔭 Usage

cstat [FLAGS] [OPTIONS] [PATH]

🔧 Help:

[FLAGS]
  -h,  --help            show help
  -q,  --quiet           suppress config output
  -f,  --fast            fast scan (skip some stats)
  -l,  --languages       list supported languages
  -j,  --json            output in json format
  -c,  --csv             output in csv format
  -ng, --no-gitignore    ignore .gitignore rules
  -v,  --version         show version

[OPTIONS]
  -t,   --threads <n>            number of threads
  -min, --min-file-size <mb>     minimum file size
  -max, --max-file-size <mb>     maximum file size (max 100MB)

  --exclude-dir <dir>            exclude directory
  --exclude-ext <ext>            exclude file extension

📦 Installation

Prebuilt binaries

Download now!

Build from source

git clone https://github.com/nchhillar2004/cstat.git
cd cstat
cmake -B build
cmake --build build --config Release

📊 benchmarks

tested on real-world data. same machine, same conditions.


🧪 test 1: linux system root /

full system scan (mixed files, binaries, configs, everything)

tool files scanned lines time (real) cpu (user) status
cstat 552,108 137.2M 23.78s 6.53s ✅ success
tokei 247,591 60.6M 10.62s 78.11s ✅ success
scc - - - - ❌ crashed
cloc - - 10m+ - ⚠️ very slow
  • cstat scans 2x+ more data than tokei
  • uses much lower CPU
  • scc could not complete the scan
  • cloc is significantly slower on large directories

🧪 test 2: vscode repository

repo: https://github.com/microsoft/vscode
size: ~122MB

tool files lines time (real) cpu (user) status
cstat 9,176 3.10M 0.059s 0.226s ✅ fastest
tokei 8,900 3.09M 0.278s 2.795s
scc 9,060 3.06M 0.309s 2.303s
cloc 8,887 - 39.160s 38.544s ⚠️ slow
  • cstat is ~4x faster than tokei
  • significantly lower CPU usage
  • cloc is much slower on same dataset

🧪 test 3: node repository

repo: https://github.com/nodejs/node
size: ~601MB

tool files lines time (real) cpu (user) status
cstat 44,243 16.3M 0.186s 0.783s ✅ fastest
tokei 42,777 16M 0.944s 10.481s
scc 42,999 16.1M 1.172s 9.182s
cloc 39,023 - 1m30s 1m29s ⚠️ slow
  • cstat is ~5x faster than tokei
  • significantly lower CPU usage