code: def extract_pareto_optimal(allres, keys, recall_idx=0, times_idx=3):
      bigtab = []
      for i, k in enumerate(keys):
          v = allres[k]
          perf = v[:, recall_idx]
          times = v[:, times_idx]
          bigtab.append(
              np.vstack((np.ones(times.size) * i, perf, times))
          )
      if bigtab == []:
          return [], np.zeros((3, 0))
  
      bigtab = np.hstack(bigtab)
  
      # sort by perf
      perm = np.argsort(bigtab[1, :])
      bigtab_sorted = bigtab[:, perm]
      best_times = np.minimum.accumulate(bigtab_sorted[2, ::-1])[::-1]
      (selection,) = np.where(bigtab_sorted[2, :] == best_times)
      selected_keys = [
          keys[i]
          for i in np.unique(bigtab_sorted[0, selection].astype(int))
      ]
      ops = bigtab_sorted[:, selection]
  
      return selected_keys, ops
  
file_path: faiss/benchs/bench_all_ivf/parse_bench_all_ivf.py
imports: import os
  import numpy
  from collections import defaultdict
  from matplotlib import pyplot
  import re
  from argparse import Namespace
  from faiss.contrib.factory_tools import get_code_size
label_desc: Use image node_id 5 for calling a global function with example usage: extract_pareto_optimal(allres, keys, recall_idx, times_idx) and returns: selected_keys,  ops, list,  np