Skip to content

Conversation

@VincentBailly
Copy link
Member

remove the creation of unnecessary lambda wrappers.

Speeds up 11% the project initialization time of tsserver in large repositories.

Fixes#61821

CopilotAI review requested due to automatic review settings June 6, 2025 11:20
@github-project-automationgithub-project-automationbot moved this to Not started in PR BacklogJun 6, 2025
@typescript-bottypescript-bot added For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Jun 6, 2025
Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR optimizes initialization by removing unnecessary lambda wrappers that were previously creating extra function objects, resulting in reduced memory usage and a faster startup for tsserver in large repositories.

  • Removed lambda wrapper functions in fileOrDirectoryExistsUsingSource for direct function calls.
  • Achieves an 11% improvement in initialization time.

@VincentBaillyVincentBaillyforce-pushed the optimize-memory-remove-lambdas branch from 53f3158 to 3af1111CompareJune 6, 2025 11:26
@jakebailey
Copy link
Member

I'm shocked this matters, the runtime is pretty good about inlining this sort of thing. How did you determine your stats?

Copy link
Member

@jakebaileyjakebailey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, this does seem fine.

@github-project-automationgithub-project-automationbot moved this from Not started to Needs merge in PR BacklogJun 6, 2025
@RyanCavanaughRyanCavanaugh merged commit 97cfa26 into microsoft:mainJun 9, 2025
32 checks passed
@github-project-automationgithub-project-automationbot moved this from Needs merge to Done in PR BacklogJun 9, 2025
@microsoftmicrosoft locked as resolved and limited conversation to collaborators Dec 9, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

For Uncommitted BugPR for untriaged, rejected, closed or missing bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Functions unnecessarily wrapped into lambda functions

4 participants

@VincentBailly@jakebailey@RyanCavanaugh@typescript-bot