Closed Bug 2001383 Opened 7 months ago Closed 7 months ago

Allow using another object's iterator for indices optimizations if possible

Categories

(Core :: JavaScript Engine: JIT, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
147 Branch
Tracking Status
firefox147 --- fixed

People

(Reporter: alexical, Assigned: alexical)

References

(Blocks 2 open bugs)

Details

(Keywords: perf-alert, Whiteboard: [sp3])

Attachments

(1 file)

Assuming a function that looks something like this:

function shallowEqual(objA, objB) {
  const keysA = Object.keys(objA);
  const keysB = Object.keys(objB);

  if (keysA.length !== keysB.length) {
	return false;
  }

  // Test for A's keys different from B.
  for (let i = 0; i < keysA.length; i++) {
	const currentKey = keysA[i];
	if (
	  	!hasOwnProperty.call(objB, currentKey) ||
	  	objA[currentKey] != objB[currentKey]
	) {
  	return false;
	}
  }

  return true;
}

We currently have optimizations for the megamorphic load for objA, but not the hasOwn / load for objB. However, if we have an iterator we got from objB and it matches the iterator for objA, we should be able to use it as a base for the same optimizations, as long as the two iterators are the same.

Whiteboard: [sp3]
Assignee: nobody → dothayer
Severity: -- → N/A
Priority: -- → P2
Pushed by abutkovits@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/3de5137e2e0a https://hg.mozilla.org/integration/autoland/rev/d7841f303558 Revert "Bug 2001383 - Allow using another object's iterator indices r=iain,nbp" for causing Btime failures.
Status: NEW → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → 147 Branch
Flags: needinfo?(dothayer)
QA Whiteboard: [qa-triage-done-c148/b147]

(In reply to Pulsebot from comment #5)

Pushed by dothayer@mozilla.com:
https://github.com/mozilla-firefox/firefox/commit/288840fe5c11
https://hg.mozilla.org/integration/autoland/rev/317713e4d42c
Allow using another object's iterator indices r=iain,nbp

Perfherder has detected a browsertime performance change from push 317713e4d42c1f24fba40808ac916e190465aa88.

No action is required from the author; this comment is provided for informational purposes only.

Improvements:

Ratio Test Platform Options Absolute values (old vs new) Performance Profiles
4% speedometer3 TodoMVC-React-Redux/CompletingAllItems/Sync linux1804-64-nightlyasrelease-qr fission webrender 38.09 -> 36.72 Before/After
3% speedometer3 TodoMVC-React-Redux/CompletingAllItems/total linux1804-64-nightlyasrelease-qr fission webrender 41.00 -> 39.63 Before/After

Need Help or Information?

If you have any questions, please reach out to bacasandrei@mozilla.com. Alternatively, you can find help on Slack by joining #perf-help, and on Matrix you can find help by joining #perftest.

Details of the alert can be found in the alert summary, including links to graphs and comparisons for each of the affected tests.

Keywords: perf-alert
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: