Skip to content

fix: simplified map+flat#193949

Merged
jrieken merged 1 commit into
microsoft:mainfrom
Connormiha:optimize-flat-map
Oct 2, 2023
Merged

fix: simplified map+flat#193949
jrieken merged 1 commit into
microsoft:mainfrom
Connormiha:optimize-flat-map

Conversation

@Connormiha

Copy link
Copy Markdown
Contributor

I did a little optimization .map + flat can be replaced by single flatMap.

@bpasero

bpasero commented Sep 25, 2023

Copy link
Copy Markdown
Contributor

Assigning to the using-new-JS-features-authority ;)

@jrieken

jrieken commented Sep 25, 2023

Copy link
Copy Markdown
Contributor

Generally this can be used but AFAIK know (and the last time we checked) it is significant slower

@jrieken

jrieken commented Sep 25, 2023

Copy link
Copy Markdown
Contributor

AFAIK know (and the last time we checked) it is significant slower

I might be mistaken and confuse it with Array.from(arrayLike, mapFn)

@Connormiha Can you check with a simple test on https://jsbench.me

@Connormiha

Copy link
Copy Markdown
Contributor Author

@jrieken

jrieken commented Oct 2, 2023

Copy link
Copy Markdown
Contributor

Thanks! I see Chrome more or less the same, Safari ~30% faster (using flatMap), and FF ~10% slower. Always a surprise but I'd say we take it

@jrieken jrieken enabled auto-merge October 2, 2023 17:40
@vscodenpa vscodenpa added this to the October 2023 milestone Oct 2, 2023
@jrieken jrieken merged commit e1d5cf5 into microsoft:main Oct 2, 2023
Alex0007 pushed a commit to Alex0007/vscode that referenced this pull request Oct 26, 2023
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants