import { Laya } from "Laya" ; import { Stage } from "laya/display/Stage" ; import { Event } from "laya/events/Event" ; import { Browser } from "laya/utils/Browser" ; import { Stat } from "laya/utils/Stat" ; import { Laya3D } from "Laya3D" ; author ...
  export class ArrayObjectPerformance { c : number = 3 ; count : number = 3000000 ; offset : number = Math . floor ( 50 ) ; array : any [ ] = new Array ( this . count ) ; object : any = { } ; defineObject : any = { } ; constructor ( ) { Laya3D . init ( 0 , 0 ) ; Laya . stage . scaleMode = Stage . SCALE_FULL ; Laya . stage . screenMode = Stage . SCREEN_NONE ; Stat . show ( ) ; Laya . stage . on ( Event . MOUSE_DOWN , this , function ( ) : void { var f = 0 ; var t = Browser . now ( ) ; t = Browser . now ( ) ; for ( var i = 0 ; i < 32 ; i ++ ) { this . defineObject [ 1 << i ] = 1 << i ; } console . log ( "DefineKeyObject" , Browser . now ( ) - t ) ; t = Browser . now ( ) ; f = 0 ; for ( var i = 0 ; i < this . count ; i ++ ) { for ( var j = 0 ; j < 32 ; j ++ ) f = this . defineObject [ 1 << j ] ; } console . log ( "DefineObject" , Browser . now ( ) - t ) ; } ) ; } }