object88 / langd

A Language Server Protocol implementation in Go for Go
MIT License
7 stars 0 forks source link

Preload and share stdlib packages #36

Closed object88 closed 6 years ago

object88 commented 6 years ago

Looking forward to when multiple workspaces are expected to run at the same time, we want to be able to share certain (presumably static) resources. When a workspace loads, if we already have the stdlib packages in place, we can save time from reloading them, and save memory from duplicating them.

object88 commented 6 years ago

Should use GOROOT information (loader override, env, runtime, etc) to check to see if the packages for the necessary stdlib are already loaded. If so, provide these to the type checker and don't reload.

May also want to consider sparsely loading: consider all stdlib packages to be shared, but only read in packages are they are required by loaded projects. Additionally, may want to keep a reference count from open projects, and track when projects are unloaded to free memory for unused packages.

object88 commented 6 years ago

All packages are now commonly available based on OS & Arch.