Skip to content

Conversation

@rbuckton
Copy link
Contributor

This change migrates a number of remaining MapLike<T> entries to Map<T>, as well as adds a number of additional functions for working with both MapLike<T> and Map<T>.

The changes in the compiler itself add an additional performance improvement, shaving another ~400ms off of the total emit time of Monaco and Angular.

This also disables the tslint restriction on use of the in operator, as offline performance tests I've run show that using in is faster than both hasOwnProperty and obj[key] when merely testing for the presence of a key. The in operator also works better when paired with delete, which is faster at removing entries from a Map<T> than setting the entry to undefined.

? assumeTrue ? TypeFacts.EQUndefinedOrNull : TypeFacts.NEUndefinedOrNull
: value.kind === SyntaxKind.NullKeyword
? assumeTrue ? TypeFacts.EQNull : TypeFacts.NENull
: assumeTrue ? TypeFacts.EQUndefined : TypeFacts.NEUndefined;
Copy link
Member

Choose a reason for hiding this comment

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

Not a fan of the ? and : prefix style. Would prefer to keep the existing formatting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can change it back. I primarily made the change to work around an issue with our .tmLanguage syntax coloring as the existing formatting resulted in syntax coloring being disabled/incorrect for the next 30 lines or so in VS Code.

Copy link
Member

Choose a reason for hiding this comment

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

Both are nigh impossible to parse for a human, fwiw :-P

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bterlson, so how's that pattern matching proposal coming along? :)

@ahejlsberg
Copy link
Member

👍 Once comments are addressed.

Thanks for cleaning all of this up. Much nicer with these changes. Just confirming that we still use MapLike<T> for the compiler APIs so minimize breaking changes?

@rbuckton
Copy link
Contributor Author

I left everything as MapLike<T> that was not marked /* @internal */, so there should be no breaking changes against our public API.

@rbuckton rbuckton merged commit 11c5c4e into master Aug 17, 2016
@rbuckton rbuckton deleted the optimizeMoreMaps branch August 17, 2016 03:11
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 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.

5 participants