@@ -38,34 +38,34 @@ def init_book():
38383939 )
4040
41- print ("Doc initialization: %.3fus" % (timeit (init_book , 1000 ) * 10 ** 6 ))
41+ print ("Doc initialization: %.3fus" % (timeit (init_book , 1000 ) * 10 ** 6 ))
4242
4343 b = init_book ()
44- print ("Doc getattr: %.3fus" % (timeit (lambda : b .name , 10000 ) * 10 ** 6 ))
44+ print ("Doc getattr: %.3fus" % (timeit (lambda : b .name , 10000 ) * 10 ** 6 ))
4545
4646 print (
4747 "Doc setattr: %.3fus"
48- % (timeit (lambda : setattr (b , "name" , "New name" ), 10000 ) * 10 ** 6 ) # noqa B010
48+ % (timeit (lambda : setattr (b , "name" , "New name" ), 10000 ) * 10 ** 6 ) # noqa B010
4949 )
5050
51- print ("Doc to mongo: %.3fus" % (timeit (b .to_mongo , 1000 ) * 10 ** 6 ))
51+ print ("Doc to mongo: %.3fus" % (timeit (b .to_mongo , 1000 ) * 10 ** 6 ))
5252
53- print ("Doc validation: %.3fus" % (timeit (b .validate , 1000 ) * 10 ** 6 ))
53+ print ("Doc validation: %.3fus" % (timeit (b .validate , 1000 ) * 10 ** 6 ))
5454
5555 def save_book ():
5656 b ._mark_as_changed ("name" )
5757 b ._mark_as_changed ("tags" )
5858 b .save ()
5959
60- print ("Save to database: %.3fus" % (timeit (save_book , 100 ) * 10 ** 6 ))
60+ print ("Save to database: %.3fus" % (timeit (save_book , 100 ) * 10 ** 6 ))
6161
6262 son = b .to_mongo ()
6363 print (
64- "Load from SON: %.3fus" % (timeit (lambda : Book ._from_son (son ), 1000 ) * 10 ** 6 )
64+ "Load from SON: %.3fus" % (timeit (lambda : Book ._from_son (son ), 1000 ) * 10 ** 6 )
6565 )
6666
6767 print (
68- "Load from database: %.3fus" % (timeit (lambda : Book .objects [0 ], 100 ) * 10 ** 6 )
68+ "Load from database: %.3fus" % (timeit (lambda : Book .objects [0 ], 100 ) * 10 ** 6 )
6969 )
7070
7171 def create_and_delete_book ():
@@ -75,7 +75,7 @@ def create_and_delete_book():
7575
7676 print (
7777 "Init + save to database + delete: %.3fms"
78- % (timeit (create_and_delete_book , 10 ) * 10 ** 3 )
78+ % (timeit (create_and_delete_book , 10 ) * 10 ** 3 )
7979 )
8080
8181
@@ -101,9 +101,9 @@ def init_company():
101101 )
102102
103103 company = init_company ()
104- print ("Big doc to mongo: %.3fms" % (timeit (company .to_mongo , 100 ) * 10 ** 3 ))
104+ print ("Big doc to mongo: %.3fms" % (timeit (company .to_mongo , 100 ) * 10 ** 3 ))
105105
106- print ("Big doc validation: %.3fms" % (timeit (company .validate , 1000 ) * 10 ** 3 ))
106+ print ("Big doc validation: %.3fms" % (timeit (company .validate , 1000 ) * 10 ** 3 ))
107107
108108 company .save ()
109109
@@ -112,17 +112,17 @@ def save_company():
112112 company ._mark_as_changed ("contacts" )
113113 company .save ()
114114
115- print ("Save to database: %.3fms" % (timeit (save_company , 100 ) * 10 ** 3 ))
115+ print ("Save to database: %.3fms" % (timeit (save_company , 100 ) * 10 ** 3 ))
116116
117117 son = company .to_mongo ()
118118 print (
119119 "Load from SON: %.3fms"
120- % (timeit (lambda : Company ._from_son (son ), 100 ) * 10 ** 3 )
120+ % (timeit (lambda : Company ._from_son (son ), 100 ) * 10 ** 3 )
121121 )
122122
123123 print (
124124 "Load from database: %.3fms"
125- % (timeit (lambda : Company .objects [0 ], 100 ) * 10 ** 3 )
125+ % (timeit (lambda : Company .objects [0 ], 100 ) * 10 ** 3 )
126126 )
127127
128128 def create_and_delete_company ():
@@ -132,7 +132,7 @@ def create_and_delete_company():
132132
133133 print (
134134 "Init + save to database + delete: %.3fms"
135- % (timeit (create_and_delete_company , 10 ) * 10 ** 3 )
135+ % (timeit (create_and_delete_company , 10 ) * 10 ** 3 )
136136 )
137137
138138
0 commit comments