• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

99designs / gqlgen / 23028497465 / 1
0%
master: 0%

Build:
DEFAULT BRANCH: master
Ran 12 Mar 2026 11:22PM UTC
Files 0
Run time 0s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

12 Mar 2026 11:18PM UTC coverage: 0.0%. Remained the same
23028497465.1

push

github

web-flow
Feature/optimize packages load validation (#4070)

* perf: optimize packages.Load and validation for 22x speedup

This PR optimizes gqlgen's package loading and validation to achieve
~22x speedup for incremental generation with validation enabled.

## Changes

### 1. Light mode prefetch (internal/code/packages.go)
- Added `lightMode` (NeedName|NeedFiles|NeedModule) for fast loading
- Added `fullMode` (includes NeedTypes|NeedSyntax|NeedTypesInfo) for when types are needed
- Added `LoadAllLight()` function for operations that don't need type info
- Modified `loadAllWithMode()` to upgrade cached packages from light to full mode on demand

### 2. Lazy type loading (codegen/config/config.go)
- Changed prefetch to use `LoadAllLight()` instead of `LoadAll()`
- Types are now loaded on-demand only for packages that need them (e.g., autobind)

### 3. go build validation (api/generate.go)
- Replaced `packages.Load` with `go build` for validation
- `go build` benefits from Go's incremental compilation cache
- Only recompiles files that actually changed

## Performance Results (tested with ~143 schema files, 1.19M lines generated)

| Scenario | Before | After | Speedup |
|----------|--------|-------|---------|
| Cold cache, validation enabled | 4m 30s | 4m 30s | - (same) |
| Warm cache, validation enabled | 4m 30s | 12s | **22x** |
| Warm cache, validation disabled | 30s | 12s | 2.5x |

## Why This Works

1. `go list -json -export` (triggered by NeedTypes) takes ~4 minutes because
   it compiles all dependencies to get export data
2. `go list -json` without -export takes ~0.67s (just lists packages)
3. `go build` with warm cache only recompiles changed files (~2s)
4. Combined with content-based file writing, unchanged generated files
   keep their mtime, so Go's build cache stays valid

## Backward Compatibility

- No API changes - existing code continues to work
- `LoadAll()` still loads with full type info when needed
- Packages are automatically upgraded from l... (continued)

0 of 0 relevant lines covered (NaN%)

0.0 hits per line

Source Files on job 23028497465.1
  • Tree
  • List 0
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 23028497465
  • 4091f008 on github
  • Prev Job for on master (#22833022762.1)
  • Next Job for on master (#23028722926.1)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc