Skip to content

Cut down on casts in forEachChild #18214

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

Closed
wants to merge 1 commit into from
Closed

Cut down on casts in forEachChild #18214

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Sep 1, 2017

Use one cast for each node kind, not one cast per property.

@ahejlsberg
Copy link
Member

Did you check whether this impacts performance, particularly in the binder? The existing casts have zero run-time cost (because they're compiled away), but the changes you are introducing do, and this is a very time critical function. Also, eventually we're going to switch the Node type to be a proper discriminated union and then we won't need the casts at all.

I'd prefer just leaving things the way there are here.

@mhegazy
Copy link
Contributor

mhegazy commented Jan 8, 2018

I am not sure i see much value in this reorganization. the type assertions do not get removed, they just reorganized, but now we have some additional code to execute at runtime.

closing for now.

@mhegazy mhegazy closed this Jan 8, 2018
@ghost ghost deleted the forEachChild branch January 8, 2018 18:41
@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants