Skip to content

Instantly share code, notes, and snippets.

@smetj
Last active March 4, 2017 07:08
Show Gist options
  • Save smetj/718cd80eccc3c8cf8b669a2a08658aab to your computer and use it in GitHub Desktop.
Save smetj/718cd80eccc3c8cf8b669a2a08658aab to your computer and use it in GitHub Desktop.
Measure time of eval() a dict string into an actual dict object
#!/usr/bin/python
from testlap import TestLap
class DictEval():
'''
eval() a dict string into an actual dict object
'''
def __init__(self):
self.dict_string = '{"one": 1, "two": 2, "three": {"two.one": 21 }}'
def test_eval_dict(self):
'''Load dict string'''
d = eval(self.dict_string)
if __name__ == '__main__':
instance=DictEval()
test_lap=TestLap(instance=instance, iterations=1000000)
test_lap.go()
@smetj
Copy link
Author

smetj commented Mar 4, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment