Repository: modin-project/modin

Issue:
Add fillna asv benchmarks for DataFrame and Series types
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. What kind of performance improvements would you like to see with this new API?

It is necessary to test `fillna` performance with the following types of `self`: [DataFrame, Series] and `value`: [scalar, dict, DataFrame, Series]. Currently we test only for DataFrame `self` and scalar `value`. The change is necessary to analyze performance change that https://github.com/modin-project/modin/issues/2803 makes.


Discussion:

Resolving patch:
diff --git a/asv_bench/benchmarks/benchmarks.py b/asv_bench/benchmarks/benchmarks.py
--- a/asv_bench/benchmarks/benchmarks.py
+++ b/asv_bench/benchmarks/benchmarks.py
@@ -375,22 +375,56 @@ def time_head(self, shape, head_count):
 
 
 class TimeFillna:
-    param_names = ["shape", "limit", "inplace"]
-    params = [UNARY_OP_DATA_SIZE[ASV_DATASET_SIZE], [None, 0.8], [False, True]]
+    param_names = ["self_type", "value_type", "shape", "limit", "inplace"]
+    params = [
+        ["DataFrame", "Series"],
+        ["scalar", "dict", "DataFrame", "Series"],
+        UNARY_OP_DATA_SIZE[ASV_DATASET_SIZE],
+        [None, 0.8],
+        [False, True],
+    ]
 
-    def setup(self, shape, limit, inplace):
+    def setup(self, self_type, value_type, shape, limit, inplace):
         pd = IMPL[ASV_USE_IMPL]
         columns = [f"col{x}" for x in range(shape[1])]
-        self.df = pd.DataFrame(np.nan, index=pd.RangeIndex(shape[0]), columns=columns)
+        if self_type == "DataFrame":
+            self.dataset = pd.DataFrame(
+                np.nan, index=pd.RangeIndex(shape[0]), columns=columns
+            )
+        elif self_type == "Series":
+            self.dataset = pd.Series(np.nan, index=pd.RangeIndex(shape[0]))
+        else:
+            assert False
+        if value_type == "scalar":
+            self.value = 18.19
+        elif value_type == "dict":
+            self.value = {k: k * 1.23 for k in range(shape[0])}
+        elif value_type == "Series":
+            self.value = pd.Series(
+                [k * 1.23 for k in range(shape[0])], index=pd.RangeIndex(shape[0])
+            )
+        elif value_type == "DataFrame":
+            if self_type == "Series":
+                raise NotImplementedError
+            self.value = pd.DataFrame(
+                {
+                    k: [i + j * 1.23 for j in range(shape[0])]
+                    for i, k in enumerate(columns)
+                },
+                index=pd.RangeIndex(shape[0]),
+                columns=columns,
+            )
+        else:
+            assert False
         self.limit = int(limit * shape[0]) if limit else None
 
-    def time_fillna(self, shape, limit, inplace):
-        kw = {"value": 0.0, "limit": self.limit, "inplace": inplace}
+    def time_fillna(self, self_type, value_type, shape, limit, inplace):
+        kw = {"value": self.value, "limit": self.limit, "inplace": inplace}
         if inplace:
-            self.df.fillna(**kw)
-            execute(self.df)
+            self.dataset.fillna(**kw)
+            execute(self.dataset)
         else:
-            execute(self.df.fillna(**kw))
+            execute(self.dataset.fillna(**kw))
 
 
 class BaseTimeValueCounts:


Test patch: