Skip to content

Commit ee4ad22

Browse files
committed
07
1 parent c244dc1 commit ee4ad22

File tree

2 files changed

+46
-3
lines changed

2 files changed

+46
-3
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import os
2+
import time
3+
import numpy
4+
5+
# temp file for benchmarking
6+
7+
8+
def timeit(method):
9+
10+
def timed(*args, **kw):
11+
ts = time.time()
12+
13+
result = method(*args, **kw)
14+
te = time.time()
15+
all_times.append(te - ts)
16+
17+
print all_times
18+
print numpy.mean(all_times)
19+
return result
20+
21+
return timed
22+
23+
24+
def create_new_db():
25+
os.system("mysqladmin -u root drop DATABASE_NAME -f")
26+
os.system("mysqladmin -u root create DATABASE_NAME -f")
27+
os.system("./manage.py syncdb")
28+
os.system("./manage.py migrate")
29+
30+
31+
@timeit
32+
def load_new_perms():
33+
os.system("./manage.py LOAD_PERMS_COMMAND")
34+
35+
36+
if __name__ == "__main__":
37+
n = 0
38+
all_times = list()
39+
while n < 10:
40+
create_new_db()
41+
load_new_perms()
42+
n += 1

readme.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
1. **01_remove_all_pyc.md**: remove all *.pyc* files from a git repo
44
1. **02_find_all_links.py**: get all links from a webpage
55
1. **03_simple_twitter_manager.py**: accessing the Twitter API, example functions
6-
3. **04_rename_with_slice.py**: rename group of files, within a single directory, using slice
7-
4. **05_load_json_without_dupes.py**: load json, convert to dict, raise error if there is a duplicate key
8-
5. **06_execution_time.py**: class used for timing execution of code
6+
1. **04_rename_with_slice.py**: rename group of files, within a single directory, using slice
7+
1. **05_load_json_without_dupes.py**: load json, convert to dict, raise error if there is a duplicate key
8+
1. **06_execution_time.py**: class used for timing execution of code
9+
1.**07_benchmark_permissions_loading_django.py**: benchmark loading of permissions in Django

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy