If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

'{}' (OP_newobject) is lower than 'new Object'

NEW
Unassigned

Status

Tamarin
Baseline JIT (CodegenLIR)
7 years ago
6 years ago

People

(Reporter: Jeff Dyer, Unassigned)

Tracking

unspecified
x86
Mac OS X
Bug Flags:
flashplayer-qrb +

Details

(Reporter)

Description

7 years ago
(The following description only applies to jitted code.)

Steps to reproduce:
1. Compile my small test app:
   http://jacksondunstan.com/articles/801
   (also attached)
2. Observe the displayed performance results
   (example SWF attached)
3. (optional) Read my analysis, complete with disassembly (by nemo440):
   http://jacksondunstan.com/articles/801
 
 Actual Results:

Creating an empty Object with the "o = {}" syntax is slower than using the equivalent "o = new Object()" syntax. The "o = new Object()" syntax creates objects 1.47x faster on Windows XP and 1.37x faster on Mac OS X 10.5.
 
 Expected Results:
Both methods of creating en empty object should yield identical bytecode and performance, i.e. the bytecode currently generated by "o = new Object()"
 
 Workaround (if any):
Change all source code using "o = {}" to "o = new Object()"
(Reporter)

Comment 1

7 years ago
Seems like there is a missing optimization for OP_newobject in the Jitter. 'new Object' is slower for interpreted code (as expected), but faster for Jitted code. Transferring to bugzilla.

Interpreted: curley 781ms, newObject 920ms
Jitted: curley 694ms, newObject 540ms

test case:

class A {
   function curley() {
      return {}
   }

   function newObject() {
      return new Object
   }
}

var a = new A;
var t0 = new Date;
for (var i: int = 0; i < 1000000; i++) {
   a.curley();
}
var t1 = new Date;
print("curley "+(t1-t0)+"ms");

t0 = new Date;
for (var i: int = 0; i < 1000000; i++) {
   a.newObject();
}
t1 = new Date;
print("newObject "+(t1-t0)+"ms");

[ Show ยป ]

Seems like there is a missing optimization for OP_newobject in the Jitter. 'new Object' is slower for interpreted code (as expected), but faster for Jitted code. Transferring to bugzilla. 

Interpreted: curley 781ms, newObject 920ms 
Jitted: curley 694ms, newObject 540ms 

test case: 

class A {
    function curley() {
       return {}
    }
    function newObject() {
       return new Object
    }
 }
 var a = new A;
 var t0 = new Date;
 for (var i: int = 0; i < 1000000; i++) {
    a.curley();
 }
 var t1 = new Date;
 print("curley "+(t1-t0)+"ms");
 t0 = new Date;
 for (var i: int = 0; i < 1000000; i++) {
    a.newObject();
 }
 t1 = new Date;
 print("newObject "+(t1-t0)+"ms");
(Reporter)

Comment 2

7 years ago
This bug is transferred from: https://bugs.adobe.com/jira/browse/ASC-4129

Comment 3

7 years ago
And what about '[]' vs 'new Array'?

Updated

6 years ago
Flags: flashplayer-qrb+
You need to log in before you can comment on or make changes to this bug.