@@ -53,19 +53,19 @@ def test_performance_b64_scatter3d():
53
53
np_time_elapsed = time .time () - np_start
54
54
55
55
# np should be faster than lists
56
- assert (np_time_elapsed / list_time_elapsed ) < 0.5
56
+ assert (np_time_elapsed / list_time_elapsed ) < 0.55
57
57
58
58
59
59
FLOAT_TEST_CASES = [
60
- ("float32" , 0.45 ), # dtype # difference threshold
61
- ("float64" , 0.55 ),
60
+ ("float32" , 100000 , 0.45 ), # dtype # difference threshold
61
+ ("float64" , 10000 , 0.55 ),
62
62
]
63
63
64
64
65
- @pytest .mark .parametrize ("dtype, expected_size_difference" , FLOAT_TEST_CASES )
66
- def test_performance_b64_float (dtype , expected_size_difference ):
67
- np_arr_1 = np .random .random (10000 ).astype (dtype )
68
- np_arr_2 = np .random .random (10000 ).astype (dtype )
65
+ @pytest .mark .parametrize ("dtype, count, expected_size_difference" , FLOAT_TEST_CASES )
66
+ def test_performance_b64_float (dtype , count , expected_size_difference ):
67
+ np_arr_1 = np .random .random (count ).astype (dtype )
68
+ np_arr_2 = np .random .random (count ).astype (dtype )
69
69
list_1 = np_arr_1 .tolist ()
70
70
list_2 = np_arr_2 .tolist ()
71
71
@@ -86,17 +86,17 @@ def test_performance_b64_float(dtype, expected_size_difference):
86
86
87
87
88
88
INT_SIZE_PERFORMANCE_TEST_CASES = [
89
- ("uint8" , 256 , 400000 ), # dtype # max_val # difference threshold
90
- ("uint32" , 2 ** 32 , 900000 ),
89
+ ("uint8" , 256 , 100000 , 30000 ),
90
+ ("uint32" , 2 ** 32 , 100000 , 100000 ),
91
91
]
92
92
93
93
94
94
@pytest .mark .parametrize (
95
- "dtype, max_val , expected_size_difference" , INT_SIZE_PERFORMANCE_TEST_CASES
95
+ "dtype, max_value, count , expected_size_difference" , INT_SIZE_PERFORMANCE_TEST_CASES
96
96
)
97
- def test_size_performance_b64_int (dtype , max_val , expected_size_difference ):
98
- np_arr_1 = (np .random .random (100000 ) * max_val ).astype (dtype )
99
- np_arr_2 = (np .random .random (100000 ) * max_val ).astype (dtype )
97
+ def test_size_performance_b64_int (dtype , max_value , count , expected_size_difference ):
98
+ np_arr_1 = (np .random .random (count ) * max_value ).astype (dtype )
99
+ np_arr_2 = (np .random .random (count ) * max_value ).astype (dtype )
100
100
101
101
# Measure the size of figures with numpy arrays
102
102
fig_np = go .Scatter (x = np_arr_1 , y = np_arr_2 )
0 commit comments