Status: New
Owner: ----

New issue 3360 by [email protected]: Setting expando properties with special characters in property name onto a function creates memory bloat
http://code.google.com/p/v8/issues/detail?id=3360

Tested in Chrome 37.0.2019.0 canary and 36.0.1985.32 beta

Setting expando like "foo-bar" onto a function object is much more expensive than setting an expando with field name "foobar". This behavior is non-intuitive and very hard to track down in real apps. Admittedly, it's not common to set expandos like these on functions.

During my testing I noticed that characters that would require the field name to be escaped are problematic, that primarily includes "-" and ".". Characters like "$" and "_" are not causing the issue.



Test case:

// establish baseline
x = [];
// heap size: ~3MB

// set expando without any special characters:
x.length = 0;
i=1000000;
while (i--) {
  var ff;
  (function(i) { function f() { return i; }; ff = f}(i));
  // set simple expando
  ff['foobar'] = null;
  x.push(ff)
}
// heap size: ~120MB

// set expando with "-" in the field name:
x.length = 0;
i=1000000;
while (i--) {
  var ff;
  (function(i) { function f() { return i; }; ff = f}(i));
  // set expando with "-" character
  ff['foo-bar'] = null;
  x.push(ff)
}
// heap size: ~500MB



--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to