Closed
Bug 921813
Opened 12 years ago
Closed 10 years ago
Arrow functions: Remove "this" binding when "this" not observable in the body.
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 989204
People
(Reporter: asaf, Unassigned)
Details
Attachments
(2 files)
Try the attached script in Scratchpad. I see a constant 10%+ difference (but I'm not sure it actually scales).
Comment 1•12 years ago
|
||
I can confirm the speed difference. However, there are quite a few other constructs in the test that we don't yet fully optimize (i.e., array comprehensions and generators).
I created a version that calculates the same results in a very different way, getting rid of everything but a single list.filter call in the functions under test. This version has a speed difference of 2-3%, when run in the shell.
Comment 2•12 years ago
|
||
Note that
x => set.has(x)
is literally equivalent to:
function (x) { set.has(x) }.bind(this)
and not:
function (x) { set.has(x) }
We should optimize the arrow functions when "this" is not observable in the body of arrow function.
Summary: Arrow functions performance issue → Arrow functions: Remove "this" binding when "this" not observable in the body.
![]() |
||
Comment 3•10 years ago
|
||
Is this still valid? I get a difference of less than 1% between the two on the second testcase.
Comment 4•10 years ago
|
||
This has been fixed yes.
http://www.jandemooij.nl/blog/2014/04/11/fast-arrow-functions-in-firefox-31/
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•