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

Make eager service registration explicit and revisit existing one #159178

Closed
jrieken opened this issue Aug 25, 2022 · 26 comments
Closed

Make eager service registration explicit and revisit existing one #159178

jrieken opened this issue Aug 25, 2022 · 26 comments
Assignees
Labels
debt Code quality issues perf-startup
Milestone

Comments

@jrieken
Copy link
Member

jrieken commented Aug 25, 2022

The registerSingleton-function supports a supportsDelayedInstantiation-argument.

With InstantiationType.Delayed only proxies of services are injected and the actual instantiation happens in "slack/idle" time or at time of first actual use (whatever comes first). This is often overlooked and the default (false, eager) is used. This issue is about:

  • revisit existing eager usages and check if they can support delayed instantiation. This is the preferred way, helps startup performance 🐎 , and is usually possible
  • make the eager variant explicit, use InstantiationType.Eager, and feel a little bad about it 😳

Note that Eager should only be needed if your service is doing something "by its own", like reading files or so, which is vital to other parts of the system. This should be the exception because most services offer something (a service) to others which means can be delayed until needed

@jrieken
Copy link
Member Author

jrieken commented Aug 29, 2022

@sandy081 starting with you because many of your services show as eager

@sandy081 sandy081 added this to the September 2022 milestone Aug 31, 2022
sandy081 added a commit that referenced this issue Aug 31, 2022
* #159178 make service instantiation lazy

* add comment

* update comment

* make comment clear about cyclic dep

* :lisptick:
@sandy081 sandy081 removed their assignment Sep 1, 2022
@sandy081
Copy link
Member

sandy081 commented Sep 1, 2022

@jrieken adopted those service I own

@jrieken
Copy link
Member Author

jrieken commented Sep 2, 2022

@bpasero you are next :-)

bpasero added a commit that referenced this issue Sep 2, 2022
@bpasero
Copy link
Member

bpasero commented Sep 2, 2022

Went over the ones I consider owning and found some that can be lazy: #159899

Some observations:

  • would be nice to somehow signal back that service cannot be lazy so that we know which ones are not acknowledged (I guess that is the purpose of this issue but might be nicer to validate in code)
  • services that are implemented from a workbench part are instantiated on startup anyway because workbench parts are never lazy (even when hidden)
  • I was not so sure for the ext-host services, they seem to require the main side proxy in their constructor so I left them, maybe we do a pass at once in those

bpasero added a commit that referenced this issue Sep 2, 2022
* perf - more lazy services (#159178)

* restore
@bpasero bpasero removed their assignment Sep 3, 2022
@bpasero
Copy link
Member

bpasero commented Sep 3, 2022

Also did #159972 which forces every remote service (i.e. a service that talks to the main process or shared process) to be lazy. All of these services did already declare laziness but now its just enabled by default.

@jrieken
Copy link
Member Author

jrieken commented Sep 5, 2022

would be nice to somehow signal back that service cannot be lazy so that we know which ones are not acknowledged (I guess that is the purpose of this issue but might be nicer to validate in code)

I like - I'll add another falsy value like "eager" or so

@jrieken
Copy link
Member Author

jrieken commented Sep 5, 2022

#160061

roblourens added a commit that referenced this issue Oct 5, 2022
roblourens added a commit that referenced this issue Oct 11, 2022
* Address #159178 for notebooks

* Add method to list editor decorations so they can be initialized in the lazy instantiated NotebookService
@hediet hediet removed their assignment Oct 13, 2022
hediet added a commit that referenced this issue Oct 13, 2022
hediet added a commit that referenced this issue Oct 13, 2022
@joaomoreno joaomoreno assigned mjbvz and unassigned joaomoreno Oct 13, 2022
joaomoreno added a commit that referenced this issue Oct 13, 2022
joaomoreno added a commit that referenced this issue Oct 13, 2022
mjbvz added a commit to mjbvz/vscode that referenced this issue Oct 20, 2022
mjbvz added a commit that referenced this issue Oct 20, 2022
@mjbvz mjbvz removed their assignment Oct 21, 2022
@alexdima alexdima removed their assignment Oct 22, 2022
@jrieken jrieken added languages-diagnostics Source problems reporting and removed languages-diagnostics Source problems reporting labels Oct 24, 2022
@jrieken jrieken modified the milestones: October 2022, November 2022 Oct 24, 2022
@joyceerhl joyceerhl removed their assignment Oct 24, 2022
@jrieken
Copy link
Member Author

jrieken commented Oct 25, 2022

Thanks everyone!

@github-actions github-actions bot locked and limited conversation to collaborators Dec 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debt Code quality issues perf-startup
Projects
None yet
Development

No branches or pull requests