@@ -53,7 +53,7 @@ class Insert(ABC):
53
53
rounds = 1
54
54
55
55
@abc .abstractmethod
56
- def setup_cache (self ):
56
+ def setup (self ):
57
57
raise NotImplementedError
58
58
59
59
def time_insert_arrow (self ):
@@ -94,7 +94,7 @@ class Read(ABC):
94
94
rounds = 1
95
95
96
96
@abc .abstractmethod
97
- def setup_cache (self ):
97
+ def setup (self ):
98
98
raise NotImplementedError
99
99
100
100
# We need this because the naive methods don't always convert nested objects.
@@ -160,7 +160,7 @@ class ProfileReadArray(Read):
160
160
}
161
161
)
162
162
163
- def setup_cache (self ):
163
+ def setup (self ):
164
164
coll = db .benchmark
165
165
coll .drop ()
166
166
base_dict = dict (
@@ -205,7 +205,7 @@ class ProfileReadDocument(Read):
205
205
}
206
206
)
207
207
208
- def setup_cache (self ):
208
+ def setup (self ):
209
209
coll = db .benchmark
210
210
coll .drop ()
211
211
base_dict = dict (
@@ -247,7 +247,7 @@ class ProfileReadSmall(Read):
247
247
schema = Schema ({"x" : pyarrow .int64 (), "y" : pyarrow .float64 ()})
248
248
dtypes = np .dtype (np .dtype ([("x" , np .int64 ), ("y" , np .float64 )]))
249
249
250
- def setup_cache (self ):
250
+ def setup (self ):
251
251
coll = db .benchmark
252
252
coll .drop ()
253
253
base_dict = dict (
@@ -268,7 +268,7 @@ class ProfileReadLarge(Read):
268
268
schema = Schema ({k : pyarrow .float64 () for k in large_doc_keys })
269
269
dtypes = np .dtype ([(k , np .float64 ) for k in large_doc_keys ])
270
270
271
- def setup_cache (self ):
271
+ def setup (self ):
272
272
coll = db .benchmark
273
273
coll .drop ()
274
274
@@ -284,7 +284,7 @@ class ProfileReadExtensionSmall(Read):
284
284
schema = Schema ({"x" : Decimal128Type (), "y" : BinaryType (10 )})
285
285
dtypes = np .dtype (np .dtype ([("x" , np .object_ ), ("y" , np .object_ )]))
286
286
287
- def setup_cache (self ):
287
+ def setup (self ):
288
288
coll = db .benchmark
289
289
coll .drop ()
290
290
base_dict = dict (
@@ -299,13 +299,20 @@ def setup_cache(self):
299
299
% (N_DOCS , len (BSON .encode (base_dict )) // 1024 , len (base_dict ))
300
300
)
301
301
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
+
302
309
303
310
class ProfileReadExtensionLarge (Read ):
304
311
large_doc_keys = [f"{ i } " for i in range (LARGE_DOC_SIZE )]
305
312
schema = Schema ({k : Decimal128Type () for k in large_doc_keys })
306
313
dtypes = np .dtype ([(k , np .object_ ) for k in large_doc_keys ])
307
314
308
- def setup_cache (self ):
315
+ def setup (self ):
309
316
coll = db .benchmark
310
317
coll .drop ()
311
318
@@ -316,16 +323,20 @@ def setup_cache(self):
316
323
% (N_DOCS , len (BSON .encode (base_dict )) // 1024 , len (base_dict ))
317
324
)
318
325
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
+
319
333
320
334
class ProfileInsertSmall (Insert ):
321
335
large_doc_keys = [f"a{ i } " for i in range (LARGE_DOC_SIZE )]
322
336
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 )
326
337
dtypes = np .dtype ([("x" , np .int64 ), ("y" , np .float64 )])
327
338
328
- def setup_cache (self ):
339
+ def setup (self ):
329
340
coll = db .benchmark
330
341
coll .drop ()
331
342
base_dict = dict ([("x" , 1 ), ("y" , math .pi )])
@@ -334,17 +345,17 @@ def setup_cache(self):
334
345
"%d docs, %dk each with %d keys"
335
346
% (N_DOCS , len (BSON .encode (base_dict )) // 1024 , len (base_dict ))
336
347
)
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 )
337
351
338
352
339
353
class ProfileInsertLarge (Insert ):
340
354
large_doc_keys = [f"a{ i } " for i in range (LARGE_DOC_SIZE )]
341
355
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 )
345
356
dtypes = np .dtype ([(k , np .float64 ) for k in large_doc_keys ])
346
357
347
- def setup_cache (self ):
358
+ def setup (self ):
348
359
coll = db .benchmark
349
360
coll .drop ()
350
361
base_dict = dict ([(k , math .pi ) for k in self .large_doc_keys ])
@@ -353,3 +364,6 @@ def setup_cache(self):
353
364
"%d docs, %dk each with %d keys"
354
365
% (N_DOCS , len (BSON .encode (base_dict )) // 1024 , len (base_dict ))
355
366
)
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