Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Issue 1866713003: - Restructure the Canonicalization of instances in preparation for adding a (Closed)

Created:
4 years, 8 months ago by siva
Modified:
4 years, 8 months ago
Reviewers:
regis, srdjan
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Base URL:
git@github.com:dart-lang/sdk.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

- Restructure Canonicalization of instances in preparation for adding a HashMap to store the Canonical constants of Instances/Arrays. The goal is to continue to use an array for Numbers (Mint, Bigint, Double) and use a HashMap for other Instances/Arrays. - Check first for the array length and elements being same before checking if the TypeArguments are equivalent - Removed some unused code R=regis@google.com Committed: https://github.com/dart-lang/sdk/commit/07d0c715ff516a29a43c54fb0987dbf92ab2a86b

Patch Set 1 #

Patch Set 2 : self-review-comments #

Total comments: 8

Patch Set 3 : code-review-comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+138 lines, -108 lines) Patch
M runtime/vm/object.h View 1 2 11 chunks +23 lines, -9 lines 0 comments Download
M runtime/vm/object.cc View 1 2 16 chunks +115 lines, -99 lines 0 comments Download

Messages

Total messages: 12 (4 generated)
siva
4 years, 8 months ago (2016-04-06 21:12:20 UTC) #3
regis
LGTM https://codereview.chromium.org/1866713003/diff/20001/runtime/vm/object.cc File runtime/vm/object.cc (right): https://codereview.chromium.org/1866713003/diff/20001/runtime/vm/object.cc#newcode17353 runtime/vm/object.cc:17353: case kBigintCid: { Why are you not calling ...
4 years, 8 months ago (2016-04-06 22:02:39 UTC) #4
siva
https://codereview.chromium.org/1866713003/diff/20001/runtime/vm/object.cc File runtime/vm/object.cc (right): https://codereview.chromium.org/1866713003/diff/20001/runtime/vm/object.cc#newcode17353 runtime/vm/object.cc:17353: case kBigintCid: { On 2016/04/06 22:02:39, regis wrote: > ...
4 years, 8 months ago (2016-04-06 22:26:36 UTC) #5
srdjan
DBC https://codereview.chromium.org/1866713003/diff/20001/runtime/vm/object.cc File runtime/vm/object.cc (right): https://codereview.chromium.org/1866713003/diff/20001/runtime/vm/object.cc#newcode14672 runtime/vm/object.cc:14672: char* chars = OS::SCreate(Thread::Current()->zone(), zone
4 years, 8 months ago (2016-04-06 22:32:44 UTC) #7
siva
https://codereview.chromium.org/1866713003/diff/20001/runtime/vm/object.cc File runtime/vm/object.cc (right): https://codereview.chromium.org/1866713003/diff/20001/runtime/vm/object.cc#newcode14672 runtime/vm/object.cc:14672: char* chars = OS::SCreate(Thread::Current()->zone(), On 2016/04/06 22:32:44, srdjan wrote: ...
4 years, 8 months ago (2016-04-06 22:35:33 UTC) #8
regis
https://codereview.chromium.org/1866713003/diff/20001/runtime/vm/object.cc File runtime/vm/object.cc (right): https://codereview.chromium.org/1866713003/diff/20001/runtime/vm/object.cc#newcode17353 runtime/vm/object.cc:17353: case kBigintCid: { On 2016/04/06 22:26:36, siva wrote: > ...
4 years, 8 months ago (2016-04-06 22:42:44 UTC) #9
siva
Committed patchset #3 (id:40001) manually as 07d0c715ff516a29a43c54fb0987dbf92ab2a86b (presubmit successful).
4 years, 8 months ago (2016-04-06 22:47:47 UTC) #11
siva
4 years, 8 months ago (2016-04-06 23:22:34 UTC) #12
Message was sent while issue was closed.
On 2016/04/06 22:42:44, regis wrote:
> https://codereview.chromium.org/1866713003/diff/20001/runtime/vm/object.cc
> File runtime/vm/object.cc (right):
> 
>
https://codereview.chromium.org/1866713003/diff/20001/runtime/vm/object.cc#ne...
> runtime/vm/object.cc:17353: case kBigintCid: {
> On 2016/04/06 22:26:36, siva wrote:
> > On 2016/04/06 22:02:39, regis wrote:
> > > Why are you not calling the existing Bigint::NewCanonical as for Mint and
> > Double
> > > above?
> > 
> > Bigint::NewCanonical requires a String object which is scanned and converted
> > into a bigint, it would be expensive to convert the bigint object back to a
> > string and then call Bigint::NewCanonical.
> > 
> > I could have called Instance::CheckAndCanonicalize here but that is the code
I
> > am going to change next for instance/arrays to use a HashMap and hence that
> code
> > appears to be duplicated here.
> 
> I missed the fact that the argument is a String.
> 
>
https://codereview.chromium.org/1866713003/diff/20001/runtime/vm/object.cc#ne...
> runtime/vm/object.cc:20539: for (intptr_t i = 0; i < len; i++) {
> On 2016/04/06 22:26:36, siva wrote:
> > On 2016/04/06 22:02:39, regis wrote:
> > > Depending on len, this loop could be much more expensive than checking the
> > type
> > > arguments and could be run last (possibly only if len is above a
threshold,
> > but
> > > that requires more code).
> > > If the average array is small, checking the type arguments last is fine.
> > 
> > How many times do you think we will have a case where the length is the same
> and
> > all the objects are identical but the TypeArguments are different, I am
> thinking
> > that is a rarer case. Most of the times the length will not match or if the
> > length matches then some objects in the array will not match and we will
> bailout
> > sooner.
> > 
> > Agreed there could be a degenerate case where a 1000 length array has 999
> > elements that are identical and the last one is different.
> 
> True, checking the (identical) type first would not help in that case. What I
> had in mind is more like 2 identical arrays of 1000 elements, but one is typed
> whereas the other one is raw.
> But I agree, it is all speculation at this time :-)
> Please submit as is.

This switch seems to have improved the compile all times of green tea app
sources,
it used to take about 20 secs to do a compile all of the green tea app sources,
now it takes :
real 17.52
user 18.22
sys 1.12

Powered by Google App Engine
This is Rietveld 408576698