Skip to content

Instantly share code, notes, and snippets.

@boris-42
Last active January 8, 2016 17:46
Show Gist options
  • Save boris-42/ed8d1572929988234709 to your computer and use it in GitHub Desktop.
Save boris-42/ed8d1572929988234709 to your computer and use it in GitHub Desktop.
oslo.utils testing
import time
from oslo_utils import reflection
REPEAT = 1000000
RANGE = range(REPEAT)
class A(object):
pass
def main():
resource = A()
start = time.time()
for i in RANGE:
resource.__class__.__name__
print(time.time() - start)
start = time.time()
for i in RANGE:
reflection.get_class_name(resource, fully_qualified=False)
print(time.time() - start)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment