@@ -56,55 +56,55 @@ def test_performance_b64_scatter3d():
56
56
assert (np_time_elapsed / list_time_elapsed ) < 0.65
57
57
58
58
59
- FLOAT_TEST_CASES = [
60
- ("float32" , 100000 , 0.35 ), # dtype # difference threshold
61
- ("float64" , 100000 , 0.4 ),
62
- ]
63
-
64
-
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
- list_1 = np_arr_1 .tolist ()
70
- list_2 = np_arr_2 .tolist ()
71
-
72
- # Test the performance of the base64 arrays
73
- np_start = time .time ()
74
- fig = go .Figure (data = [go .Scattergl (x = np_arr_1 , y = np_arr_2 )])
75
- fig .show ()
76
- np_time_elapsed = time .time () - np_start
77
-
78
- # Test the performance of the normal lists
79
- list_start = time .time ()
80
- fig = go .Figure (data = [go .Scattergl (x = list_1 , y = list_2 )])
81
- fig .show ()
82
- list_time_elapsed = time .time () - list_start
83
-
84
- # np should be faster than lists
85
- assert (np_time_elapsed / list_time_elapsed ) < expected_size_difference
86
-
87
-
88
- INT_SIZE_PERFORMANCE_TEST_CASES = [
89
- ("uint8" , 256 , 10500 , 30000 ),
90
- ("uint32" , 2 ** 32 , 10500 , 100000 ),
91
- ]
92
-
93
-
94
- @pytest .mark .parametrize (
95
- "dtype, max_value, count, expected_size_difference" , INT_SIZE_PERFORMANCE_TEST_CASES
96
- )
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
-
101
- # Measure the size of figures with numpy arrays
102
- fig_np = go .Scatter (x = np_arr_1 , y = np_arr_2 )
103
- size_np = fig_np .to_json ().__sizeof__ ()
104
-
105
- # Measure the size of the figure with normal python lists
106
- fig_list = go .Scatter (x = np_arr_1 .tolist (), y = np_arr_2 .tolist ())
107
- size_list = fig_list .to_json ().__sizeof__ ()
108
-
109
- # np should be smaller than lists
110
- assert size_list - size_np > expected_size_difference
59
+ # FLOAT_TEST_CASES = [
60
+ # ("float32", 100000, 0.35), # dtype # difference threshold
61
+ # ("float64", 100000, 0.4),
62
+ # ]
63
+
64
+
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
+ # list_1 = np_arr_1.tolist()
70
+ # list_2 = np_arr_2.tolist()
71
+
72
+ # # Test the performance of the base64 arrays
73
+ # np_start = time.time()
74
+ # fig = go.Figure(data=[go.Scattergl(x=np_arr_1, y=np_arr_2)])
75
+ # fig.show()
76
+ # np_time_elapsed = time.time() - np_start
77
+
78
+ # # Test the performance of the normal lists
79
+ # list_start = time.time()
80
+ # fig = go.Figure(data=[go.Scattergl(x=list_1, y=list_2)])
81
+ # fig.show()
82
+ # list_time_elapsed = time.time() - list_start
83
+
84
+ # # np should be faster than lists
85
+ # assert (np_time_elapsed / list_time_elapsed) < expected_size_difference
86
+
87
+
88
+ # INT_SIZE_PERFORMANCE_TEST_CASES = [
89
+ # ("uint8", 256, 10500, 30000),
90
+ # ("uint32", 2**32, 10500, 100000),
91
+ # ]
92
+
93
+
94
+ # @pytest.mark.parametrize(
95
+ # "dtype, max_value, count, expected_size_difference", INT_SIZE_PERFORMANCE_TEST_CASES
96
+ # )
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
+
101
+ # # Measure the size of figures with numpy arrays
102
+ # fig_np = go.Scatter(x=np_arr_1, y=np_arr_2)
103
+ # size_np = fig_np.to_json().__sizeof__()
104
+
105
+ # # Measure the size of the figure with normal python lists
106
+ # fig_list = go.Scatter(x=np_arr_1.tolist(), y=np_arr_2.tolist())
107
+ # size_list = fig_list.to_json().__sizeof__()
108
+
109
+ # # np should be smaller than lists
110
+ # assert size_list - size_np > expected_size_difference
0 commit comments