Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using the profile decorator for memory_profiler instead of mem_profil… #174

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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)