-
Notifications
You must be signed in to change notification settings - Fork 4
性能的测试(关于子弹技能)
ilvxna edited this page Aug 15, 2018
·
1 revision
聚集在一起时测试 统一debug x64位程序测试:
>>>xxx = []
>>>def create():
for i in range(100):
xxx.append(KBEngine.createEntity("NPC",1, (0.0,0.0,0.0), (0.0,0.0,0.0), {}))
>>>create()
>>>create()
>>>create()
>>>create()
>>>create()
>>>create()
>>>create()
>>>create()
>>>create()
>>>create()
>>>len(xxx)
1000
>>>xxx[0]
NPC object at 0x000001F7E25A45A0.
>>>xxx[0].position
Vector3(0.000000, 0.000000, 0.000000), ref=true
>>>for j in range(10000):
xxx[0].position = (50000, 0, 50000)
xxx[0].position = (0, 0, 0)
coordinateSystemUpdates消耗为ncall600次, totaltime8.479
分散开测试:
>>>xxx = []
>>>iii = 0
>>>def create():
global iii
for i in range(100):
xxx.append(KBEngine.createEntity("NPC",1, (iii * 500,0.0,0.0), (0.0,0.0,0.0), {}))
iii += 1
>>>create()
>>>create()
>>>create()
>>>create()
>>>create()
>>>create()
>>>create()
>>>create()
>>>create()
>>>create()
>>>xxx[0].position
Vector3(0.000000, 0.000000, 0.000000), ref=true
>>>for j in range(100):
xxx[0].position = (50000, 0, 50000)
xxx[0].position = (0, 0, 0)
>>>for j in range(100):
xxx[0].position = (50000, 0, 50000)
xxx[0].position = (0, 0, 0)
>>>len(xxx)
1000
>>>xxx[-1].position
Vector3(499500.000000, 0.000000, 0.000000), ref=true
>>>for j in range(100):
xxx[-1].position = (50000, 0, 50000)
xxx[-1].position = (499500, 0, 0)
>>>for j in range(100):
xxx[-1].position = (50000, 0, 50000)
xxx[-1].position = (499500, 0, 0)
使用xxx[0]来移动测试 coordinateSystemUpdates消耗为ncall600次, totaltime0.415
使用xxx[-1]来移动测试 coordinateSystemUpdates消耗为ncall600次, totaltime0.8
你可以试试demo。