| 124 | return arr |
| 125 | |
| 126 | def print_qtime(self, ltimes): |
| 127 | ltimes = np.array(ltimes) |
| 128 | print("Raw query times:\n", ltimes) |
| 129 | print("Histogram times:\n", np.histogram(ltimes[1:])) |
| 130 | ntimes = len(ltimes) |
| 131 | qtime1 = ltimes[0] # First measured time |
| 132 | if ntimes > 5: |
| 133 | # Wait until the 5th iteration (in order to |
| 134 | # ensure that the index is effectively cached) to take times |
| 135 | qtime2 = sum(ltimes[5:]) / (ntimes - 5) |
| 136 | else: |
| 137 | qtime2 = ltimes[-1] # Last measured time |
| 138 | print(f"1st query time: {qtime1:.3f}") |
| 139 | print(f"Mean (skipping the first 5 meas.): {qtime2:.3f}") |
| 140 | |
| 141 | def query_db(self, niter, avoidfscache, verbose): |
| 142 | self.con = self.open_db() |