graphify icon indicating copy to clipboard operation
graphify copied to clipboard

[Bug]: graphify query loads every language extractor just for _file_stem (about 34 ms per call)

Open rohit-jsfreaky opened this issue 3 weeks ago • 1 comments

Pre-flight checks

  • [x] I have checked the Troubleshooting section in the README

What happened?

graphify query (and the MCP server's graph load) imports every language extractor before answering. Both call graph_has_legacy_ids in graphify/build.py, which imports _file_stem from graphify.extractors.base. Importing that package loads all the extractors, about 55 ms, for a 3-line helper.

python -X importtime -m graphify query "..." on click: graphify.extractors costs about 34 ms of 229 ms of top-level imports. Agents call query many times per task, so this is paid on every call.

Steps to reproduce

cd click && graphify update .
python -X importtime -m graphify query "how does Context invoke a command" 2>&1 | grep graphify.extractors

Error output or graph output

graphify.extractors and the language extractor modules show up in the import trace of a read-only command.

Graphify version

0.9.106 (v8 at 35d1d203)

Operating System

Linux (measured), also Windows

Python Version

3.13

Installation Method

uv tool install (recommended)

rohit-jsfreaky avatar Nov 11 '26 18:11 rohit-jsfreaky

Thanks for opening this issue, @rohit-jsfreaky. A maintainer will take a look soon.

If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.

To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.

github-actions[bot] avatar Nov 11 '26 18:11 github-actions[bot]