Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize basic intercepted operations #2965

Closed
kasperl opened this issue May 9, 2012 · 15 comments
Closed

Optimize basic intercepted operations #2965

kasperl opened this issue May 9, 2012 · 15 comments
Labels
dart2js-optimization P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug web-dart2js

Comments

@kasperl
Copy link

kasperl commented May 9, 2012

Right now, we're using certain non-inlined helpers for implementing the basic intercepted operations:

$.ge = function(a, b) {
  if ($.checkNumbers(a, b) === true) {
    return a >= b;
  }
  return a.operator$ge$1(b);
};

This needs to be faster (either through manual or automatic inlining of the helpers). This issue is related to issue #2964.

@kasperl
Copy link
Author

kasperl commented Sep 3, 2012

Set owner to ngeoffray@google.com.
Added this to the Later milestone.

@rakudrama
Copy link
Member

When the second argument is known, the helper should be specialized.

$.ltB = function(a, b) {
  return typeof a === 'number' && typeof b === 'number' ? a < b : $.lt$slow(a, b) === true;
};

$.lt$slow = function(a, b) {
  if ($.checkNumbers(a, b))
    return a < b;
  return a.operator$lt$1(b);
};

...
  if ($.ltB(index, 0))
    return;

This should be specialized, adding:

$.ltB_0 = function(a) {
  return typeof a === 'number' ? a < 0 : a.operator$lt$1(0) === true;
};

  if ($.ltB_0(index))
    return;

In my hand-optimizing experiments, the specialization was important, especially for the common cases (constants like 0, 1). Simply specializing on type leaves the JS engine with multiple representations for b.

@kasperl
Copy link
Author

kasperl commented Oct 17, 2012

Removed this from the Later milestone.

@kasperl
Copy link
Author

kasperl commented Oct 17, 2012

Added this to the M2 milestone.

@kasperl
Copy link
Author

kasperl commented Oct 17, 2012

Removed Priority-Medium label.
Added Priority-Low label.

@peter-ahe-google
Copy link
Contributor

Removed this from the M2 milestone.
Added this to the Later milestone.
Removed Priority-Low label.
Added Priority-Medium label.

@DartBot
Copy link

DartBot commented Dec 16, 2012

This comment was originally written by @bp74


I have a lot of code where the compiler knows that the left and right side of the operation are integers, but operators like >> or ~/ are executed with the helper methods. In such cases the performance is much(!) slower compared to native (or inlined) JavaScript code. Another consequence is that the compiler does not know that the operation has no side effects, which kills optimizations like range analysis for indexers.

@kasperl
Copy link
Author

kasperl commented May 23, 2013

Added TriageForM5 label.

@kasperl
Copy link
Author

kasperl commented May 28, 2013

Is there anything left to do for this, Nicolas?


Removed TriageForM5 label.

@DartBot
Copy link

DartBot commented May 28, 2013

This comment was originally written by ngeoffray@google.com


Yes, we don't create specialized interceptors based on the argument type/value.


Removed Type-Defect label.
Added Type-Enhancement label.

@DartBot
Copy link

DartBot commented Dec 19, 2013

This comment was originally written by ngeoffray@google.com


Set owner to @floitschG.

@floitschG
Copy link
Contributor

Removed the owner.
Added Optimization label.

@kasperl
Copy link
Author

kasperl commented Jul 10, 2014

Removed this from the Later milestone.
Added Oldschool-Milestone-Later label.

@kasperl
Copy link
Author

kasperl commented Aug 4, 2014

Removed Oldschool-Milestone-Later label.

@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug and removed triaged labels Feb 29, 2016
@rakudrama
Copy link
Member

Closing as obsolete - we don't do interceptors that way anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dart2js-optimization P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug web-dart2js
Projects
None yet
Development

No branches or pull requests

6 participants