es5 Sorting algorithm change causes breakage
Reported by
kkaul1...@gmail.com,
Oct 17
|
||||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.67 Safari/537.36 Steps to reproduce the problem: With the old sorting algorithm, we were relying on the sorting being called twice, for each combination of variables. sort(a.x,b.y) would check twice for both (a.x with b.y) and with (b.x with a.y) We were relying on this functionality in our project which is now broken because of the algorithm update. What is the expected behavior? What went wrong? Algorithm update caused old functionality to break. Did this work before? N/A Chrome version: 70.0.3538.67 Channel: stable OS Version: OS X 10.14.0 Flash Version:
,
Oct 17
Ya it seems odd to rely on this functionality since it varied between browsers. Can you provide more details of your project so we determine impact?
,
Oct 17
,
Oct 18
,
Oct 18
The order and number of comparison calls in Array.p.sort is completely unspecced and not something you rely on. Is it possible to change your project's implementation? See https://tc39.github.io/ecma262/#sec-array.prototype.sort for more details.
,
Oct 18
The project is for quite a big corporation that caters to some other major companies like big airlines with this project. I believe the implementation can be changed but it will take some time. Is there an interim solution?
,
Oct 19
Besides implementing your own sorting algorithm (and possibly monkey-patching Array.p.sort) or not relying on implementation details, I'm afraid there isn't.
,
Oct 19
|
||||||
►
Sign in to add a comment |
||||||
Comment 1 by woxxom@gmail.com
, Oct 17