Status: Unconfirmed
Owner: ----
Labels: Type-Bug Pri-2 OS-All Area-Misc

New issue 22212 by c...@volny.cz: JavaScript - very slow access to not  
existing object property by constant name
http://code.google.com/p/chromium/issues/detail?id=22212

Chrome Version       : 3.0.195.21
Other browsers tested:
      Safari 4: OK
   Firefox 3.x: OK
          IE 7: OK
          IE 8: OK

What steps will reproduce the problem?

There is a script to run, it alerts the access times.
The access to not existing property by constant is about 10x slower than
by computed name and about 200x slower than to existing property.

<html>
<body>
<script>

function Test(){
var O = {};

var D1 = new Date();
for(var i=0;i<1000000;i++) O.Test;

var D2 = new Date();
var name = "Te"+"st";
for(var i=0;i<1000000;i++) O[name];

O.Test = null;

var D3 = new Date();
for(var i=0;i<1000000;i++) O.Test;

var D4 = new Date();
var name = "Te"+"st";
for(var i=0;i<1000000;i++) O[name];

alert("not existing constant:   "+(D2-D1)+"  \nnot existing computed:   "+
(D3-D2)+"  \nexisting constant:   "+(D4-D3)+"  \nexisting computed:   "+
(new Date()-D4));
}

Test();

</script>
</body>
</html>

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
Automated mail from issue updates at http://crbug.com/
Subscription options: http://groups.google.com/group/chromium-bugs
-~----------~----~----~----~------~----~------~--~---

Reply via email to