Skip to content

Commit

Permalink
EXPERIMENTAL: Suppress 'set' events in constructor.
Browse files Browse the repository at this point in the history
This is a behavior change, but it doesn't break any existing tests and gives a
20% speed improvement on large queries.

This change is not backward compatible, but no existing tests relied on the
old behavior, and I expect there are few or no real-world use cases that want
to be notified of "set" events whenever an object is constructed (including
objects constructed as part of result sets).
  • Loading branch information
mbrubeck committed Mar 31, 2009
1 parent 9e12800 commit dbb0553
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/active_record/main.js
Expand Up @@ -489,8 +489,7 @@ ActiveRecord = {
if(!field.primaryKey)
{
var value = ActiveRecord.connection.fieldOut(field,this.get(key));
//don't supress notifications on set since these are the processed values
this.set(key,value);
this.set(key,value,true);
}
}
//performance optimization if no observers
Expand Down

0 comments on commit dbb0553

Please sign in to comment.