Skip to content

Instantly share code, notes, and snippets.

@ccanepa
Created October 24, 2014 04:06
Show Gist options
  • Save ccanepa/afff47be7e4563841e45 to your computer and use it in GitHub Desktop.
Save ccanepa/afff47be7e4563841e45 to your computer and use it in GitHub Desktop.
from __future__ import print_function
import timeit
setup = (
"import cocos.collision_model as cm;" +
"import cocos.euclid as eu;" +
"rect1 = cm.AARectShape(eu.Vector2(1.0, 1.0), 2.0, 3.0);" +
"rect2 = cm.AARectShape(eu.Vector2(3.0, 3.0), 2.0, 3.0)")
res = timeit.repeat(stmt="a = rect1.distance(rect2)", setup=setup, repeat=3, number=1000000)
print(res)
print(min(res))
##Results, py2.6
##
##with cocos master: 2.88287998255
##with cocos daniel: 9.71700318483
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment