when.js currently calls Object.freeze() on all promises it creates. The thinking is that something so basic as a promise should not be allowed to be tampered with. Other promise libs, such as Q, freeze their promises for similar reasons. Unfortunately, it turns out there's a rather horrendous performance penalty for accessing properties of frozen objects in v8. This affects both node and chrome. You can see it in action in
this jsperf and also in these promise performance tests:
results of when.js calling Object.freeze vs.
results of when.js NOT calling Object.freeze
As of v1.5.1 when.js provides a way to turn off the calls to freeze() via a load-time configuration, but I'm wondering if we should just remove freeze() entirely until the v8 perf situation gets better.
So, the real question is, does anyone actually care if promises are frozen or not? Regardless of the v8 situation, does freeze()ing them provide some benefit in your situation? If so, or if not, I'd love to hear.
Thanks!
b