3 ms·
Pjs may work for a small number of objects, but if you're dealing with a large number of intances from a single class Pjs is going to use much more memory than
by bmuon 15y ago
Pjs may work for a small number of objects, but if you're dealing with a large number of intances from a single class Pjs is going to use much more memory than needed. That's because the recommended method P(function () { this.method = fn; }) is declaring all methods as instances properties instead of using the prototype, so all methods are actually new functions in new own properties instead of properties of a shared object (the prototype).