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

Simplify chaining of transforms #22994

Merged
merged 2 commits into from Apr 25, 2019
Merged

Simplify chaining of transforms #22994

merged 2 commits into from Apr 25, 2019

Conversation

ghost
Copy link

@ghost ghost commented Mar 29, 2018

The function is used in one place and only ever called variadically, so it's really just a for-loop with a map ahead of time to fill in context.

@ghost ghost requested a review from rbuckton March 29, 2018 18:44
@@ -150,7 +150,13 @@ namespace ts {
performance.mark("beforeTransform");

// Chain together and initialize each transformer.
const transformation = chain(...transformers)(context);
const transformersWithContext = transformers.map(t => t(context));
Copy link
Member

Choose a reason for hiding this comment

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

Can you verify the performance of this change against a large project? The original version was written so that the final transformation of a file would basically be a function like x => d(c(b(a(x)))) for simple cases rather than relying on array iteration. If anything, I would have been tempted to expand compose and chain to ensure a simple compiled function for a larger number of inputs before falling back to array iteration. To be honest though, since we don't use it heavily the performance characteristics of this approach may be negligible unless you have a large project with a lot of small files.

@typescript-bot
Copy link
Collaborator

Thanks for your contribution. This PR has not been updated in a while and cannot be automatically merged at the time being. For housekeeping purposes we are closing stale PRs. If you'd still like to continue working on this PR, please leave a message and one of the maintainers can reopen it.

@ghost ghost reopened this Nov 14, 2018
@ghost ghost assigned rbuckton Nov 16, 2018
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

Successfully merging this pull request may close these issues.

None yet

3 participants