Browse Source

Slightly faster BufferGeometry's toJSON

I did not time it, but the logic says native methods should be faster. Right now editor's export is quite slow, I guess, in large part because of this.
makc 10 years ago
parent
commit
851580c30a
1 changed files with 1 additions and 7 deletions
  1. 1 7
      src/core/BufferGeometry.js

+ 1 - 7
src/core/BufferGeometry.js

@@ -896,13 +896,7 @@ THREE.BufferGeometry.prototype = {
 
 			var attribute = attributes[ key ];
 
-			var array = [], typeArray = attribute.array;
-
-			for ( var i = 0, l = typeArray.length; i < l; i ++ ) {
-
-				array[ i ] = typeArray[ i ];
-
-			}
+			var array = Array.prototype.slice.call( attribute.array );
 
 			output.data.attributes[ key ] = {
 				itemSize: attribute.itemSize,