Closed Bug 478782 Opened 15 years ago Closed 15 years ago

Performance -- Calling unshift method of array 50000 times takes a long time to run

Categories

(Tamarin Graveyard :: Virtual Machine, defect)

x86
All
defect
Not set
major

Tracking

(Not tracked)

VERIFIED WORKSFORME

People

(Reporter: jodyer, Unassigned)

References

Details

Test case : Existing test case in flashfarm--main/as/qe/performance/microbenchmarks/array
var ITERATION:Number = 50000; 

var start:Number = 0;

var end:Number = 0;



var myArray = new Array();

start = getTimer();

for (var i:Number =0; i<ITERATION; i++) 

{

	myArray.unshift("myValue");

}

end = getTimer();

print (end - start);


Reproduction:  compile arrayUnshift3.as with the following command
asc -import c:/flashfarm/main/as/asrt/test/global.abc arrayUnshift3.as

Run it with avmplus arrayUnshift3.abc

Actual Results:avmplus takes 937238ms to run it and hangs the performance test suite(jscript takes 11290 ms)
.

To run the performance test suite: 1.  Install perl
2. Get runtests.pl from perforce -- flashfarm -- main/as/qe/performance 
3. In the commandline do the following export ASC= path where your asc.jar is
                                                              export GLOBALABC=where your global.abc file is
                                                              export AVM=path to where your avmplus.exe is
4. perl ./runtests.pl --c microbenchmarks/array/arrayUnshift3.as (to compile and run the performance microbenchmark test case)

To just run it: perl ./runtests.pl microbenchmarks/array/arrayUnshift3.as
        
        
        
        
        
        
        
        
        
        
        
Transferred Comments:

BugDB Migration - Mon Jun 04 12:32:46 CDT 2007
[ssubrama 1/9/07] Entered Bug.
[ssubrama 1/9/07] html file in the bugfiles folder

JIRA Migration Admin - Mon Jun 04 12:32:46 CDT 2007
Milestone ID = 1378
Milestone = FP 10 - Code Complete
Build ID = 23495
Build = AVMPLUS_1_0_0_d693
Fix Build ID = null
Fix Build = null


JIRA Migration Admin - Mon Jun 04 12:32:46 CDT 2007
Move from BugDB issue number 195081

Lars Hansen - Thu Dec 13 10:12:44 CST 2007
The problem is that the generic unshift code is written in AS3 and is a heavy user of 'in' and 'delete'.  This can be optimized in several ways but exactly how depends on the array representation; hooks are needed.

A probable simple fix that takes care of most uses for the moment is to recognize when 'this' is an instance of Array (though not of a subclass of Array) and in that case delegate to AS3::unshift.  (Subclasses ought to be excluded because getters and setters 
added in the subclass could get in the way?  Working hypothesis.)


Trevor Baker - Tue Jan 27 15:55:18 CST 2009
back to internal review for reprioritization


This bug transferred from: http://bugs.adobe.com/jira/browse/ASC-2260
A fix along the lines of what I describe above went into redux recently, so this bug may have been "fixed" more or less by that.
Blocks: AS3_Builtins
961 ms on my MacBook Pro.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → WORKSFORME
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.