Skip to content

Make eager service registration explicit and revisit existing one #159178

Closed

Description

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

Activity

  1. jrieken commented on Aug 29, 2022

    @jrieken
    ContributorAuthor

    Sandeep Somavarapu (@sandy081) starting with you because many of your services show as eager

  2. added 2 commits that reference this issue on Aug 31, 2022
  3. sandy081 commented on Sep 1, 2022

    @sandy081
    Member

    Johannes Rieken (@jrieken) adopted those service I own

  4. jrieken commented on Sep 2, 2022

    @jrieken
    ContributorAuthor
  5. bpasero commented on Sep 2, 2022

    @bpasero
    Contributor

    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
  6. 76 remaining items

  7. removed their assignment
    on Oct 21, 2022
  8. added
    languages-diagnostics
    and removed
    languages-diagnostics
    on Oct 24, 2022
  9. removed their assignment
    on Oct 24, 2022
  10. jrieken commented on Oct 25, 2022

    @jrieken
    ContributorAuthor

    Thanks everyone!

  11. locked and limited conversation to collaborators on Dec 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

debtperf-startup

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions