소스 검색

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 년 전
부모
커밋
851580c30a
1개의 변경된 파일1개의 추가작업 그리고 7개의 파일을 삭제
  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,