-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Lines 50 to 61 in 3fe059f
| // otherwise, create a dynamic function in order to use `new` | |
| // Note using `function.bind` would be simpler, but is much slower: | |
| // http://jsperf.com/new-operator-with-dynamic-function-vs-bind | |
| "var argList = '';" + | |
| "for (var i = 0, len = args.length; i < len; i++) {" + | |
| "if (i > 0) argList += ',';" + | |
| "argList += 'args[' + i + ']';" + | |
| "}" + | |
| "var constructCall = Function('constructor, args'," + | |
| "'return new constructor(' + argList + ');'" + | |
| ");" + | |
| "var value = constructCall(constructor, args);" |
Right there, I visited that link, and it seems nowadays bind is a lot faster (in Chrome):
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
