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

Issue 11233035: Use == instead of identical for integers. (Closed)

Created:
8 years, 2 months ago by floitsch
Modified:
8 years, 1 month ago
Reviewers:
ahe, Mads Ager (google)
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Use == instead of identical for integers. Committed: https://code.google.com/p/dart/source/detail?r=13875

Patch Set 1 #

Patch Set 2 : Fix typos. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+9 lines, -9 lines) Patch
M lib/compiler/implementation/string_validator.dart View 1 4 chunks +9 lines, -9 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
floitsch
8 years, 2 months ago (2012-10-22 13:12:25 UTC) #1
Mads Ager (google)
LGTM
8 years, 2 months ago (2012-10-22 13:14:40 UTC) #2
ahe
Please put the compile-time constants on the left-hand side.
8 years, 2 months ago (2012-10-22 14:07:42 UTC) #3
ahe
Any progress on addressing my comments?
8 years, 1 month ago (2012-10-30 06:48:07 UTC) #4
Lasse Reichstein Nielsen
I actually prefer to read the constants on the right.
8 years, 1 month ago (2012-10-30 08:37:06 UTC) #5
ahe
On 2012/10/30 08:37:06, Lasse Reichstein Nielsen wrote: > I actually prefer to read the constants ...
8 years, 1 month ago (2012-10-30 10:04:10 UTC) #6
Florian Schneider
On 2012/10/30 10:04:10, ahe wrote: > On 2012/10/30 08:37:06, Lasse Reichstein Nielsen wrote: > > ...
8 years, 1 month ago (2012-10-30 10:07:11 UTC) #7
ahe
8 years, 1 month ago (2012-10-30 11:11:27 UTC) #8
On 2012/10/30 10:07:11, Florian Schneider wrote:
> On 2012/10/30 10:04:10, ahe wrote:
> > On 2012/10/30 08:37:06, Lasse Reichstein Nielsen wrote:
> > > I actually prefer to read the constants on the right.
> > 
> > I'm concerned about performance. I know the VM generates better code when
the
> > constant is on the left-hand side.
> 
> It should not matter performance-wise where you place the constants in a ==
> expression. - If it still does, please file a bug against the VM.

Adding a little more info here: I had assumed that 2 == x could basically be
compiled to an efficient check similar to 2 === x. However, Since 2 == 2.0 in
Dart, both 2 == x and x == 2 requires a SMI check.

In that case, let's keep the code as is.

Powered by Google App Engine
This is Rietveld 408576698