Skip to content

Conversation

MaxGraey
Copy link
Member

@MaxGraey MaxGraey commented Oct 1, 2019

This normalize Array#sort() for portable so now:

[0, -0, -1, NaN, Infinity, 2, 123].sort()

output (which the same as AS):

[ -1, -0, 0, 2, 123, Infinity, NaN ]

instead:

[ -1, 0, -0, 123, 2, Infinity, NaN ]

This also speed-up array's sort

@dcodeIO
Copy link
Member

dcodeIO commented Oct 1, 2019

Does this work for arrays of strings?

@MaxGraey
Copy link
Member Author

MaxGraey commented Oct 1, 2019

Does this work for arrays of strings?

yes

And for arrays with mixed strings and null / undefined

@MaxGraey
Copy link
Member Author

MaxGraey commented Oct 1, 2019

Also with latest version I got pretty cheap overhead:
bench

@MaxGraey
Copy link
Member Author

MaxGraey commented Oct 1, 2019

ok it seems I'm happy with this solution.
@dcodeIO try test this with different types. And if it will be ok it could be merged I guess

@MaxGraey MaxGraey requested a review from dcodeIO October 3, 2019 12:01
@dcodeIO dcodeIO merged commit 5055bbc into AssemblyScript:master Oct 13, 2019
@MaxGraey MaxGraey deleted the add-def-portable-comparator branch October 13, 2019 18:23
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.

2 participants