Closed Bug 594465 Opened 14 years ago Closed 6 years ago

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

Categories

(Tamarin Graveyard :: Baseline JIT (CodegenLIR), defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: jodyer, Unassigned)

Details

(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()"
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");
This bug is transferred from: https://bugs.adobe.com/jira/browse/ASC-4129
And what about '[]' vs 'new Array'?
Flags: flashplayer-qrb+
Tamarin isn't maintained anymore. WONTFIX remaining bugs.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.