Typical sizes (Project files): ~index.db size, time to index (on a relatively nice machine)
- Small (100 files): ~10 MB, ~2s
- Med (1K files): ~100 MB, ~10s
- Large (10K files): ~750 MB, ~45s
- Giant (30K files): ~7000 MB, ~500s (tested on llvm-project)
- Titan (TBD)
Optimization:
- Use
--silentfor large projects - Run indexers in parallel with WAL mode
- Use
--exclude-dirfor dependency folders - Index only source directories (exclude tests, docs)
- Write and read code-index.db to/from a ram disk (--db-file /dev/shm/index.db)
Fast queries:
- Exact matches:
qi getUserById - Prefix matches:
qi get* - With filters:
qi user -i func -f .c
Slower queries:
- Wildcard everywhere:
qi '*user*' - No filters:
qi '*' - Complex AND queries
Optimization:
- Start specific, broaden if needed
- Use
--limitand--limit-per-filewhile exploring - Combine context and file filters
- Use
--defto filter out usages
Indexing:
- Start small - index one directory first
- Use daemon mode for active development
- Exclude build artifacts in ignore list
Querying:
- Start with
-x noiseto exclude comments/strings (and consider placing this line in ~/.smconfig) - Use
-eand-Cto see definitions and context - Use
--limitwhile exploring - Two-step workflow: discover (--toc, -i func), then expand (-e)
- Combine filters for precision
Example workflow:
# Step 1: Discover (fast, targeted)
qi handle* -i func --def --limit-per-file 2 --limit 10
# Step 2: See table of contents for selected file
qi -f c_language.c --toc
# Step 3: Expand (show code) for selected function
qi handle_do_statement -f c_language.c --def -e# Code symbols - use qi
qi CursorManager
qi *manager* -i class
# Text/messages - use grep
grep "Error: connection failed" *.c
# Exclude noise for cleaner results
qi user -x noise
# Compact output (default) vs full names
qi user # Shows: VAR, FUNC, etc.
qi user --full # Shows: VARIABLE, FUNCTION, etc.