Use extend rather than prototype for createFrame
Using prototype has a large performance impact for the common case of a sparse set of private variable data points. Rather than incurring the overhead of creating and walking the prototype tree for this, performing an extend by copy.
This commit is contained in:
@@ -73,10 +73,9 @@ Handlebars.registerHelper('blockHelperMissing', function(context, options) {
|
||||
|
||||
Handlebars.K = function() {};
|
||||
|
||||
Handlebars.createFrame = Object.create || function(object) {
|
||||
Handlebars.K.prototype = object;
|
||||
var obj = new Handlebars.K();
|
||||
Handlebars.K.prototype = null;
|
||||
Handlebars.createFrame = function(object) {
|
||||
var obj = {};
|
||||
Handlebars.Utils.extend(obj, object);
|
||||
return obj;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user