🐛 Chrome 70 array.sort uses stable TimSort which exposed bunch of bugs#18777
Merged
aghassemi merged 3 commits intoampproject:masterfrom Oct 17, 2018
Merged
🐛 Chrome 70 array.sort uses stable TimSort which exposed bunch of bugs#18777aghassemi merged 3 commits intoampproject:masterfrom
aghassemi merged 3 commits intoampproject:masterfrom
Conversation
aghassemi
commented
Oct 17, 2018
| it('custom Array#sort()', () => { | ||
| expect(evaluate('[11, 1, 2].sort()')).to.deep.equal([1, 11, 2]); | ||
| expect(evaluate('[11, 1, 2].sort((x, y) => x > y)')) | ||
| expect(evaluate('[11, 1, 2].sort((x, y) => x - y)')) |
Contributor
Author
There was a problem hiding this comment.
Contributor
Author
|
@jridgewell @dvoytenko I am merging to make master green and unblock PRs, but please do review and I will address comments in a separate PR. |
Merged
noranazmy
pushed a commit
to noranazmy/amphtml
that referenced
this pull request
Oct 18, 2018
Enriqe
pushed a commit
to Enriqe/amphtml
that referenced
this pull request
Nov 28, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Chrome switched to a version of V8 that has implemented a new sorting algorithm (TimSort instead of QuickSort) which is stable. We have had bunch of bad compare functions and had been lucky so far with unstable result matching our expectations but, well lucky streak is over.
See https://twitter.com/mathias/status/1036626116654637057
Additionally the 15px scrollbar is gone in Chrome 70
Back to sort issues:
1-
sortInDomOrderin fixed layer was mostly wrong.2- can't do
sort((x, y) => x > yanymore (sure it was wrong in the first place, but... it worked)3-
platform-store.js's sort was unstable.