@@ -53,7 +53,7 @@ class Insert(ABC):
5353 rounds = 1
5454
5555 @abc .abstractmethod
56- def setup_cache (self ):
56+ def setup (self ):
5757 raise NotImplementedError
5858
5959 def time_insert_arrow (self ):
@@ -94,7 +94,7 @@ class Read(ABC):
9494 rounds = 1
9595
9696 @abc .abstractmethod
97- def setup_cache (self ):
97+ def setup (self ):
9898 raise NotImplementedError
9999
100100 # We need this because the naive methods don't always convert nested objects.
@@ -160,7 +160,7 @@ class ProfileReadArray(Read):
160160 }
161161 )
162162
163- def setup_cache (self ):
163+ def setup (self ):
164164 coll = db .benchmark
165165 coll .drop ()
166166 base_dict = dict (
@@ -205,7 +205,7 @@ class ProfileReadDocument(Read):
205205 }
206206 )
207207
208- def setup_cache (self ):
208+ def setup (self ):
209209 coll = db .benchmark
210210 coll .drop ()
211211 base_dict = dict (
@@ -247,7 +247,7 @@ class ProfileReadSmall(Read):
247247 schema = Schema ({"x" : pyarrow .int64 (), "y" : pyarrow .float64 ()})
248248 dtypes = np .dtype (np .dtype ([("x" , np .int64 ), ("y" , np .float64 )]))
249249
250- def setup_cache (self ):
250+ def setup (self ):
251251 coll = db .benchmark
252252 coll .drop ()
253253 base_dict = dict (
@@ -268,7 +268,7 @@ class ProfileReadLarge(Read):
268268 schema = Schema ({k : pyarrow .float64 () for k in large_doc_keys })
269269 dtypes = np .dtype ([(k , np .float64 ) for k in large_doc_keys ])
270270
271- def setup_cache (self ):
271+ def setup (self ):
272272 coll = db .benchmark
273273 coll .drop ()
274274
@@ -284,7 +284,7 @@ class ProfileReadExtensionSmall(Read):
284284 schema = Schema ({"x" : Decimal128Type (), "y" : BinaryType (10 )})
285285 dtypes = np .dtype (np .dtype ([("x" , np .object_ ), ("y" , np .object_ )]))
286286
287- def setup_cache (self ):
287+ def setup (self ):
288288 coll = db .benchmark
289289 coll .drop ()
290290 base_dict = dict (
@@ -299,13 +299,20 @@ def setup_cache(self):
299299 % (N_DOCS , len (BSON .encode (base_dict )) // 1024 , len (base_dict ))
300300 )
301301
302+ # This must be skipped because arrow can't read the Decimal128Type
303+ def time_conventional_arrow (self ):
304+ pass
305+
306+ def time_insert_conventional (self ):
307+ pass
308+
302309
303310class ProfileReadExtensionLarge (Read ):
304311 large_doc_keys = [f"{ i } " for i in range (LARGE_DOC_SIZE )]
305312 schema = Schema ({k : Decimal128Type () for k in large_doc_keys })
306313 dtypes = np .dtype ([(k , np .object_ ) for k in large_doc_keys ])
307314
308- def setup_cache (self ):
315+ def setup (self ):
309316 coll = db .benchmark
310317 coll .drop ()
311318
@@ -316,16 +323,20 @@ def setup_cache(self):
316323 % (N_DOCS , len (BSON .encode (base_dict )) // 1024 , len (base_dict ))
317324 )
318325
326+ # This must be skipped because arrow can't read the Decimal128Type
327+ def time_conventional_arrow (self ):
328+ pass
329+
330+ def time_insert_conventional (self ):
331+ pass
332+
319333
320334class ProfileInsertSmall (Insert ):
321335 large_doc_keys = [f"a{ i } " for i in range (LARGE_DOC_SIZE )]
322336 schema = Schema ({"x" : pyarrow .int64 (), "y" : pyarrow .float64 ()})
323- arrow_table = find_arrow_all (db .benchmark , {}, schema = schema )
324- pandas_table = find_pandas_all (db .benchmark , {}, schema = schema )
325- numpy_arrays = find_numpy_all (db .benchmark , {}, schema = schema )
326337 dtypes = np .dtype ([("x" , np .int64 ), ("y" , np .float64 )])
327338
328- def setup_cache (self ):
339+ def setup (self ):
329340 coll = db .benchmark
330341 coll .drop ()
331342 base_dict = dict ([("x" , 1 ), ("y" , math .pi )])
@@ -334,17 +345,17 @@ def setup_cache(self):
334345 "%d docs, %dk each with %d keys"
335346 % (N_DOCS , len (BSON .encode (base_dict )) // 1024 , len (base_dict ))
336347 )
348+ self .arrow_table = find_arrow_all (db .benchmark , {}, schema = self .schema )
349+ self .pandas_table = find_pandas_all (db .benchmark , {}, schema = self .schema )
350+ self .numpy_arrays = find_numpy_all (db .benchmark , {}, schema = self .schema )
337351
338352
339353class ProfileInsertLarge (Insert ):
340354 large_doc_keys = [f"a{ i } " for i in range (LARGE_DOC_SIZE )]
341355 schema = Schema ({k : pyarrow .float64 () for k in large_doc_keys })
342- arrow_table = find_arrow_all (db .benchmark , {}, schema = schema )
343- pandas_table = find_pandas_all (db .benchmark , {}, schema = schema )
344- numpy_arrays = find_numpy_all (db .benchmark , {}, schema = schema )
345356 dtypes = np .dtype ([(k , np .float64 ) for k in large_doc_keys ])
346357
347- def setup_cache (self ):
358+ def setup (self ):
348359 coll = db .benchmark
349360 coll .drop ()
350361 base_dict = dict ([(k , math .pi ) for k in self .large_doc_keys ])
@@ -353,3 +364,6 @@ def setup_cache(self):
353364 "%d docs, %dk each with %d keys"
354365 % (N_DOCS , len (BSON .encode (base_dict )) // 1024 , len (base_dict ))
355366 )
367+ self .arrow_table = find_arrow_all (db .benchmark , {}, schema = self .schema )
368+ self .pandas_table = find_pandas_all (db .benchmark , {}, schema = self .schema )
369+ self .numpy_arrays = find_numpy_all (db .benchmark , {}, schema = self .schema )
0 commit comments