| 176 | param_names = ["index_type"] |
| 177 | |
| 178 | def setup(self, index_type): |
| 179 | N = 10**5 |
| 180 | values = list("a" * N + "b" * N + "c" * N) |
| 181 | arr = { |
| 182 | "monotonic_incr": np.array(values, dtype=object), |
| 183 | "monotonic_decr": np.array(list(reversed(values)), dtype=object), |
| 184 | "non_monotonic": np.array(list("abc") * N, dtype=object), |
| 185 | }[index_type] |
| 186 | |
| 187 | self.data = libindex.ObjectEngine(arr) |
| 188 | # code below avoids populating the mapping etc. while timing. |
| 189 | self.data.get_loc("b") |
| 190 | |
| 191 | def time_get_loc(self, index_type): |
| 192 | self.data.get_loc("b") |