Settings

Theme

Show HN: Toktrack – 1000x faster AI CLI cost tracker (Rust and SIMD)

github.com

4 points by mag123c 2 months ago · 4 comments · 1 min read

Reader

Did you know Claude Code deletes your session data after 30 days? I found out the hard way when I tried to check my spending history.

My session files hit 3GB (2000+ files) and existing tools took 40+ seconds. Rewrote it in Rust with simd-json + rayon.

- First run: ~1s (vs 40s+) - Daily use: ~0.04s (1000x faster, cached) - TUI dashboard with daily/weekly/monthly breakdown - Supports Claude Code, Codex CLI, Gemini CLI - Persistent cache — history survives even after CLI deletes files

GitHub: https://github.com/mag123c/toktrack

Feedback welcome!

nadis 2 months ago

Interesting! Sort of a tangential question to the product itself but why did you choose to build primarily in Rust? I saw "built with Rust + simd-json + ratatui for ultra-fast performance" but am not actually very familiar with how these technology choices specifically enable ultra-fast performance. Would love to learn more!

  • mag123cOP 2 months ago

    Good question! Honestly, the README is a bit misleading - ratatui is just for the terminal UI, not performance. Let me clarify

    The actual speed comes from

    1.simd-json: This is the big one. It uses CPU SIMD instructions to parse multiple JSON bytes in parallel at the hardware level. We're talking ~3 GiB/s vs ~300 MB/s with standard parsers.

    2.rayon: Dead simple parallel processing. Instead of parsing 2,000 files one by one, it spreads them across all CPU cores.

    3.Rust itself: No GC means no random pauses when you're crunching through gigabytes of data. The original Node.js version would just... freeze sometimes.

    The 40s → 0.04s improvement basically "what if we actually used the hardware properly?" SIMD for parsing, all cores for parallelism, no GC getting in the way. (I should probably fix that README line - thanks for pointing it out!)

    • nadis a month ago

      Thanks for the clarification, I really appreciate it! This makes more sense and was helpful. Appreciate you taking the time to respond.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection