Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Generators/people.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import mem_profile
import memory_profiler
import random
import time

Expand All @@ -7,6 +8,7 @@

print 'Memory (Before): {}Mb'.format(mem_profile.memory_usage_psutil())

@memory_profiler.profile(precision=2)
def people_list(num_people):
result = []
for i in xrange(num_people):
Expand All @@ -18,6 +20,7 @@ def people_list(num_people):
result.append(person)
return result

@memory_profiler.profile(precision=2)
def people_generator(num_people):
for i in xrange(num_people):
person = {
Expand All @@ -36,4 +39,4 @@ def people_generator(num_people):
t2 = time.clock()

print 'Memory (After) : {}Mb'.format(mem_profile.memory_usage_psutil())
print 'Took {} Seconds'.format(t2-t1)
print 'Took {} Seconds'.format(t2-t1)