Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"reloading module info" doesn't work #2505

Closed
vikstrous2 opened this issue Jan 12, 2023 · 1 comment
Closed

"reloading module info" doesn't work #2505

vikstrous2 opened this issue Jan 12, 2023 · 1 comment

Comments

@vikstrous2
Copy link

What happened?

I see "reloading module info" 3 times when we generate our config, so I did a little test to see if it actually helps with anything. It doesn't appear to. It seems to just cause unnecessary slowness.

diff --git a/internal/code/packages.go b/internal/code/packages.go
index c800d3d8..bb92c802 100644
--- a/internal/code/packages.go
+++ b/internal/code/packages.go
@@ -71,6 +71,9 @@ func (p *Packages) LoadAll(importPaths ...string) []*packages.Package {
                        fmt.Println("reloading module info")
                        pkgs, err = packages.Load(&packages.Config{Mode: mode}, missing...)
                }
+               if !p.checkModuleLoaded(pkgs) {
+                       fmt.Println("waste of time")
+               }
 
                if err != nil {
                        p.loadErrors = append(p.loadErrors, err)

What did you expect?

reloading module info
reloading module info
reloading module info

What I saw:

reloading module info
waste of time
reloading module info
waste of time
reloading module info
waste of time

Minimal graphql.schema and models to reproduce

our config is massive, sorry...

versions

  • go run github.com/99designs/gqlgen version? 0.17.22
  • go version? 1.19

Removing this "reloading" reduces the run time for us from 38s to 26s

@vikstrous2
Copy link
Author

I also see that if we don't call "evict" or "reloadall" we can run gqlgen in 15s rather than 26, so saving 10s or 50% of the run time... but that's a topic for another issue.

vikstrous added a commit to vikstrous/gqlgen that referenced this issue Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant