code: def plot_subset(
      allres,
      allstats,
      selected_methods,
      recall_idx,
      times_idx=3,
      report=["overhead", "build time"],
  ):
      # important methods
      for k in selected_methods:
          v = allres[k]
  
          stats = allstats[k]
          d = stats["d"]
          dbsize = stats["nb"]
          if "index_size" in stats and "tables_size" in stats:
              tot_size = stats["index_size"] + stats["tables_size"]
          else:
              tot_size = -1
          id_size = 8  # 64 bit
  
          addt = ""
          if "add_time" in stats:
              add_time = stats["add_time"]
              if add_time > 7200:
                  add_min = add_time / 60
                  addt = ", %dh%02d" % (add_min / 60, add_min % 60)
              else:
                  add_sec = int(add_time)
                  addt = ", %dm%02d" % (add_sec / 60, add_sec % 60)
  
          code_size = unitsize(d, k)
  
          label = k
  
          if "code_size" in report:
              label += " %d bytes" % code_size
  
          tight_size = (code_size + id_size) * dbsize
  
          if tot_size < 0 or "overhead" not in report:
              pass  # don't know what the index size is
          elif tot_size > 10 * tight_size:
              label += " overhead x%.1f" % (tot_size / tight_size)
          else:
              label += " overhead+%.1f%%" % (
                  tot_size / tight_size * 100 - 100
              )
  
          if "build time" in report:
              label += " " + addt
  
          linestyle = (
              ":"
              if "Refine" in k or "RFlat" in k
              else "-."
              if "SQ" in k
              else "-"
              if "4fs" in k
              else "-"
          )
          print(k, linestyle)
          pyplot.semilogy(
              v[:, recall_idx],
              1000 / v[:, times_idx],
              label=label,
              linestyle=linestyle,
              marker="o" if "4fs" in k else "+",
          )
  
      recall_rank = stats["ranks"][recall_idx]
      if stats["measure"] == "recall":
          pyplot.xlabel("1-recall at %d" % recall_rank)
      elif stats["measure"] == "inter":
          pyplot.xlabel("inter @ %d" % recall_rank)
      else:
          assert False
      pyplot.ylabel("QPS (%d threads)" % stats["n_threads"])
  
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 6 for calling a global function with example usage: plot_subset(allres, allstats, selected_methods, recall_idx, times_idx, report) without return types