code: def benchmark_serializer(dumps, loads, data, num):
      buf = dumps(data)
  
      enc_timer = Timer()
      dec_timer = Timer()
      enc_timer.pause()
      dec_timer.pause()
  
      for k in range(num):
          enc_timer.resume()
          buf = dumps(data)
          enc_timer.pause()
  
          dec_timer.resume()
          loads(buf)
          dec_timer.pause()
  
      dumps_time = enc_timer.seconds() / num
      loads_time = dec_timer.seconds() / num
      return dumps_time, loads_time
  
file_path: tensorpack/tests/benchmark-serializer.py
imports: import numpy
  import argparse
  import pyarrow
  from tabulate import tabulate
  import operator
  from tensorpack.utils import logger
  from tensorpack.utils.serialize import MsgpackSerializer, PyarrowSerializer, PickleSerializer, ForkingPickler
  from tensorpack.utils.timer import Timer
label_desc: Use image node_id 1 for calling a global function with example usage: benchmark_serializer(dumps, loads, data, num) and returns: dumps_time,  loads_time