Commit 9b0fc8a
perf(codegen): replace source importer with gcexportdata for ~1000x faster type resolution (MadAppGang#58)
* perf(codegen): replace source importer with gcexportdata for ~1000x faster type resolution
The type resolver previously used importer.ForCompiler("source") which
recursively parses all transitive dependencies from .go source files.
For large dependency graphs (e.g., Cosmos SDK), this took 15+ minutes.
Now uses gcexportdata to read pre-compiled type data from Go's build
cache via `go list -export -deps`. Benchmarks show:
- go list -export -deps: ~42ms (finds all dependency export files)
- gcexportdata.Read() for all deps: ~23ms
- Cached (second call, same process): 750ns
The gcExportImporter also caches `go list` results across multiple
NewTypeResolver calls, eliminating the duplicate invocation between
Phase 0 (semantic validation) and Step 2.1 (error propagation).
Falls back to source importer if `go list -export` fails.
Addresses MadAppGang#38
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(codegen): remove GOFLAGS clearing and capture go list stderr
Review feedback from 6-model team review:
- Remove GOFLAGS= override that broke vendor mode projects
- Capture go list stderr for better error diagnostics
- File descriptor leak was a false positive (os.Open error IS checked
before defer f.Close() is registered)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 50826b2 commit 9b0fc8a
1 file changed
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
110 | 112 | | |
111 | 113 | | |
112 | 114 | | |
113 | | - | |
| 115 | + | |
114 | 116 | | |
115 | 117 | | |
116 | 118 | | |
| |||
0 commit comments