Closed Bug 1222547 Opened 4 years ago Closed 18 days ago

Remove Array generics

Categories

(Core :: JavaScript Engine, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla71
Tracking Status
firefox45 --- affected
firefox71 --- fixed

People

(Reporter: arai, Assigned: evilpie)

References

(Blocks 1 open bug)

Details

(Keywords: addon-compat, dev-doc-needed, site-compat)

Attachments

(2 files)

Array generics are non-standard SpiderMonkey extension and they should be removed.
  * Array.concat
  * Array.every
  * Array.filter
  * Array.forEach
  * Array.indexOf
  * Array.join
  * Array.lastIndexOf
  * Array.map
  * Array.pop
  * Array.push
  * Array.reduce
  * Array.reduceRight
  * Array.reverse
  * Array.shift
  * Array.slice
  * Array.some
  * Array.sort
  * Array.splice
  * Array.unshift
Depends on: 1228975
We should probably add telemetry and then warnings.
Some of them should be used frequently (like, Array.slice, Array.forEach), and some other won't be.
searching AMO repository might give us some data.

not sure if it worth getting telemetry for each function tho.
See Also: → 1222552
Duplicate of this bug: 1304530
What about Array.from() and Array.isArray() ? Does this bug mean anything starting with Array. or only the specific listed methods?
Array.from and Array.isArray (and Array.of) are in spec.

this bug is about non-standard static methods listed in comment #0.

Sadly some of those functions still have quite a few uses inside Firefox. If we added a warning those might go away, but would also annoy other developers.

(In reply to Tom Schuster [:evilpie] from comment #7)

Sadly some of those functions still have quite a few uses inside Firefox. If we added a warning those might go away, but would also annoy other developers.

Which other developers are using these functions?

Depends on: 1536860
Depends on: 1540396

BMO uses the generic Array.forEach, luckily they seem to provide a polyfill. The code comes from http://dean.edwards.name/base/forEach.js.

Depends on: 1540457
Depends on: 1540149
Depends on: 1541245
Depends on: 1544834
Depends on: 1558914
No longer depends on: 1540425
See Also: → 1540425
Duplicate of this bug: 1559576
Assignee: nobody → evilpies

Some the measured values are still extremely high, especially slice and forEach. On the other hand I haven't seen any fallout from this change on Nightly. Maybe there a lot of instances where websites already have some fallback/polyfill for other browsers.

Jason what do you think?

Flags: needinfo?(jorendorff)

Let's try it!

Flags: needinfo?(jorendorff)
Pushed by evilpies@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/311d8c50d88b
Remove JavaScript Array generics. r=jandem
Flags: needinfo?(evilpies)
Status: NEW → RESOLVED
Closed: 18 days ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla71

== Change summary for alert #23288 (as of Mon, 30 Sep 2019 16:54:49 GMT) ==

Improvements:

0.49% Base Content JS macosx1014-64-shippable opt 4,080,544.00 -> 4,060,677.33
0.39% Base Content JS linux64 opt 4,071,397.33 -> 4,055,626.67
0.38% Base Content JS linux64-qr opt 4,071,344.00 -> 4,055,760.00
0.38% Base Content JS linux64-shippable opt 4,071,317.33 -> 4,055,680.00
0.38% Base Content JS linux64-shippable-qr opt 4,071,317.33 -> 4,055,653.33
0.38% Base Content JS windows10-64 opt 4,138,698.67 -> 4,122,928.00
0.38% Base Content JS windows10-64-qr opt 4,138,672.00 -> 4,122,901.33
0.38% Base Content JS windows10-64-shippable opt 4,138,698.67 -> 4,122,981.33
0.38% Base Content JS windows10-64-shippable-qr opt 4,138,752.00 -> 4,122,901.33
0.33% Base Content JS windows7-32 opt 3,239,056.00 -> 3,228,528.00
0.32% Base Content JS windows7-32-shippable opt 3,239,045.33 -> 3,228,528.00

For up to date results, see: https://treeherder.mozilla.org/perf.html#/alerts?id=23288

You need to log in before you can comment on or make changes to this bug.