SHARE
TWEET

Untitled

a guest Dec 9th, 2013 192 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import bpy, time
  2. from bpy.props import *
  3.  
  4. s = bpy.context.scene
  5. obs = bpy.data.objects
  6. first_ob = None
  7. db = "DatablockProperty" in dir(bpy.props)
  8.  
  9. print("Benchmarking ","DatablockVectorProperty" if db else "FloatVectorProperty")
  10.  
  11. def make_prop():
  12.         return DatablockVectorProperty(type=bpy.types.ID,size=2) if db else FloatVectorProperty(size=2)
  13.  
  14. class PerfTest(bpy.types.PropertyGroup):
  15.         prop = make_prop()
  16.         prop2 = make_prop()
  17.         prop3 = make_prop()
  18.  
  19. bpy.utils.register_module(__name__)
  20. bpy.types.Object.test = PointerProperty(type=PerfTest)
  21.  
  22. if not db:
  23.         value = [1,1]
  24. for i in range(10000):
  25.         ob = obs.new(name="Empty",object_data=None)    
  26.         if not first_ob:
  27.                 first_ob = ob
  28.                 if db: value = [ob,ob]
  29.         else:
  30.                 ob.test.prop = value
  31.                 ob.test.prop2 = value
  32.                 ob.test.prop3 = value
  33.  
  34. start = time.time()
  35. obs.remove(first_ob)
  36. print("Deleted in ",time.time() - start)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top