Created
September 14, 2011 15:25
-
-
Save kwk/1216865 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To iterate over all of my stores records (60 in total) and change one column this little snippet takes ~70m. | |
store.each(function(record) { | |
record.beginEdit(); // supress any updates to store | |
record.set("status", 0); | |
record.endEdit(); | |
return true; // false will abort iteration | |
}); | |
// When I iterate over only have of the records in my store, the above snippet takes about ~35ms. | |
var i = 0; | |
store.each(function(record) { | |
record.beginEdit(); // supress any updates to store | |
record.set("status", extensionStateMap[record.get("exten")] ); | |
record.endEdit(); | |
return (i++ < 30); // false will abort iteration | |
}); | |
// Is there a way to mark compact all changes made to the store and commit them at once? | |
// Something like this would be great: | |
store.beginEdit(); | |
store.each(function(record) { | |
record.set("status", 0); | |
return true; // false will abort iteration | |
}); | |
store.endEdit(); | |
// Obviously these beginEdit() and endEdit() functions do not exists for a store. | |
// But I think you get the idea of what I'm trying to achieve here. | |
// The changes I make to the store only need to be updated in-memory. | |
// There's no need to commit them back to a server or so. | |
// Is there any way to make changing all records in a store faster? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment