Skip to content

Instantly share code, notes, and snippets.

@vlyahovich
Created October 5, 2014 19:25
Show Gist options
  • Save vlyahovich/e259d87234a6dfa90b7f to your computer and use it in GitHub Desktop.
Save vlyahovich/e259d87234a6dfa90b7f to your computer and use it in GitHub Desktop.
Fast and slow objects example
function FastPurchase (units, price) {
this.units = units;
this.price = price;
this.total = 0;
this.x = 1;
};
var fast = new FastPurchase(3, 25);
fast.x = null;
function SlowPurchase (units, price) {
this.units = units;
this.price = price;
this.total = 0;
this.x = 1;
};
var slow = new SlowPurchase(3, 25);
delete slow.x;
// Up to 3 times more memory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment