This repository has been archived by the owner on Feb 22, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(bracket): Optimize calling methods on objects.
Optimize the closures used for calling methods on objects by getting rid of an intermediate "field access" that loads the function from the object. This allows us to use InstanceMirror.invoke more directly. Performance =========== The performance implications of this change look good. On the native Dart VM, calling methods through the reflective path becomes 4.5x faster. When compiled to JavaScript, the difference is even bigger and it is 6.7x faster. Dart VM: new: o.f() => g: 18,885,385.384 ops/sec r: 2,252,149.057 ops/sec h: 2,233,514.96 ops/sec i: 32,662,458.941 ops/sec old: o.f() => g: 18,118,349.692 ops/sec r: 496,119.238 ops/sec h: 6,234,893.68 ops/sec i: 31,472,943.499 ops/sec Dart2js: new: o.f() => g: 2,618,328.337 ops/sec r: 1,234,723.632 ops/sec h: 1,234,745.10 ops/sec i: 7,507,441.131 ops/sec old: o.f() => g: 2,427,133.253 ops/sec r: 184,727.903 ops/sec h: 500,226.70 ops/sec i: 7,461,638.467 ops/sec
- Loading branch information
Showing
3 changed files
with
21 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ main(arguments) { | |
"a.b.c", | ||
"x.b.c", | ||
"e1.b", | ||
"o.f()", | ||
"1", "-1", "+1", | ||
"!true", | ||
"3*4/2%5", "3+6-2", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
525eead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a partial pull to me? The changes to ParserBackend.functionCall and ParserBackend.fieldAccess are missing so this basically doesn't optimize anything. What am I missing?
525eead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea what happened here. I have remerged the code here: 12f5f67