code: 
  
  
  import json
  import os
  import tempfile
  
  import datasets
  from datasets.arrow_writer import ArrowWriter
  from datasets.features import ArrayaD
  from utils import generate_examples, get_duration
  
  
  __a   				=      (30, 4_87)
  __a   				=      (36, 10_24)
  __a   				=      (1_00, 1_00)
  __a   				=      1_00
  
  __a   				=      datasets.Features(
      {'''text''': ArrayaD(SHAPE_TEST_1, dtype='''float32'''), '''image''': ArrayaD(SHAPE_TEST_2, dtype='''float32''')}
  )
  
  __a				,      __a   				=      os.path.split(__file__)
  __a   				=      os.path.join(RESULTS_BASEPATH, '''results''', RESULTS_FILENAME.replace('''.py''', '''.json'''))
  
  
  
  
  @get_duration
  def 			__lowercase	(						_UpperCamelCase,    _UpperCamelCase,    _UpperCamelCase     )    ->List[Any]:
  
  
  
  
  
  
  
        """simple docstring"""
  
        with ArrowWriter(features=_UpperCamelCase,    path=os.path.join(_UpperCamelCase,    '''beta.arrow'''     )     ) as writer:
              for key, record in dummy_data:
                    lowercase			:   Tuple					   =		my_features.encode_example(_UpperCamelCase     )
                    writer.write(_UpperCamelCase     )
              lowercase   ,			lowercase			:   List[Any]					   =		writer.finalize()
  
  
  
  
  @get_duration
  def 			__lowercase	(						_UpperCamelCase,    _UpperCamelCase     )    ->List[str]:
  
  
  
  
  
  
  
        """simple docstring"""
  
        lowercase			:   List[str]					   =		datasets.Dataset.from_file(
            filename=os.path.join(_UpperCamelCase,    '''beta.arrow'''     ),    info=datasets.DatasetInfo(features=_UpperCamelCase     )     )
        for _ in dataset:
              pass
  
  
  
  
  @get_duration
  def 			__lowercase	(						_UpperCamelCase,    _UpperCamelCase     )    ->Optional[int]:
  
  
  
  
  
  
  
        """simple docstring"""
  
        lowercase			:   Dict					   =		datasets.Dataset.from_file(
            filename=os.path.join(_UpperCamelCase,    '''beta.arrow'''     ),    info=datasets.DatasetInfo(features=_UpperCamelCase     )     )
        dataset.set_format('''numpy'''     )
        for _ in dataset:
              pass
  
  
  
  
  @get_duration
  def 			__lowercase	(						_UpperCamelCase,    _UpperCamelCase     )    ->Tuple:
  
  
  
  
  
  
  
        """simple docstring"""
  
        lowercase			:   Optional[int]					   =		10
        lowercase			:   List[Any]					   =		datasets.Dataset.from_file(
            filename=os.path.join(_UpperCamelCase,    '''beta.arrow'''     ),    info=datasets.DatasetInfo(features=_UpperCamelCase     )     )
        for i in range(0,    len(_UpperCamelCase     ),    _UpperCamelCase     ):
              lowercase			:   int					   =		dataset[i : i + batch_size]
  
  
  
  
  @get_duration
  def 			__lowercase	(						_UpperCamelCase,    _UpperCamelCase     )    ->Union[str, Any]:
  
  
  
  
  
  
  
        """simple docstring"""
  
        lowercase			:   Optional[int]					   =		10
        lowercase			:   List[str]					   =		datasets.Dataset.from_file(
            filename=os.path.join(_UpperCamelCase,    '''beta.arrow'''     ),    info=datasets.DatasetInfo(features=_UpperCamelCase     )     )
        dataset.set_format('''numpy'''     )
        for i in range(0,    len(_UpperCamelCase     ),    _UpperCamelCase     ):
              lowercase			:   Dict					   =		dataset[i : i + batch_size]
  
  
  
  
  @get_duration
  def 			__lowercase	(						_UpperCamelCase,    _UpperCamelCase     )    ->int:
  
  
  
  
  
  
  
        """simple docstring"""
  
        lowercase			:   Any					   =		datasets.Dataset.from_file(
            filename=os.path.join(_UpperCamelCase,    '''beta.arrow'''     ),    info=datasets.DatasetInfo(features=_UpperCamelCase     )     )
        for col in feats:
              lowercase			:   Optional[int]					   =		dataset[col]
  
  
  
  
  @get_duration
  def 			__lowercase	(						_UpperCamelCase,    _UpperCamelCase     )    ->Optional[Any]:
  
  
  
  
  
  
  
        """simple docstring"""
  
        lowercase			:   Any					   =		datasets.Dataset.from_file(
            filename=os.path.join(_UpperCamelCase,    '''beta.arrow'''     ),    info=datasets.DatasetInfo(features=_UpperCamelCase     )     )
        dataset.set_format('''numpy'''     )
        for col in feats:
              lowercase			:   Dict					   =		dataset[col]
  
  
  
  
  def 			__lowercase	(						)    ->Dict:
  
  
  
  
  
  
  
        """simple docstring"""
  
        lowercase			:   Union[str, Any]					   =		{}
        lowercase			:   Dict					   =		(
            read_unformated,
            read_formatted_as_numpy,
            read_batch_unformated,
            read_batch_formatted_as_numpy,
            read_col_unformated,
            read_col_formatted_as_numpy,
        )
        with tempfile.TemporaryDirectory() as tmp_dir:
              lowercase			:   str					   =		datasets.Features({'''image''': ArrayaD(_UpperCamelCase,    dtype='''float32'''     )}     )
              lowercase			:   List[Any]					   =		generate_examples(features=_UpperCamelCase,    num_examples=_UpperCamelCase     )
              lowercase			:   List[str]					   =		write(_UpperCamelCase,    _UpperCamelCase,    _UpperCamelCase     )
              for read_func in read_functions:
                    lowercase			:   Dict					   =		read_func(_UpperCamelCase,    _UpperCamelCase     )
  
        with tempfile.TemporaryDirectory() as tmp_dir:
              # don't use fixed length for fair comparison
              # feats = datasets.Features(
              #     {"image": datasets.Sequence(datasets.Sequence(datasets.Value("float32"), SPEED_TEST_SHAPE[1]), SPEED_TEST_SHAPE[0])}
              # )
              lowercase			:   Optional[Any]					   =		datasets.Features({'''image''': datasets.Sequence(datasets.Sequence(datasets.Value('''float32'''     )     )     )}     )
              lowercase			:   Optional[int]					   =		generate_examples(
                  features=_UpperCamelCase,    num_examples=_UpperCamelCase,    seq_shapes={'''image''': SPEED_TEST_SHAPE}     )
              lowercase			:   Any					   =		write(_UpperCamelCase,    _UpperCamelCase,    _UpperCamelCase     )
              for read_func in read_functions:
                    lowercase			:   Union[str, Any]					   =		read_func(_UpperCamelCase,    _UpperCamelCase     )
  
        with tempfile.TemporaryDirectory() as tmp_dir:
              # don't use fixed length for fair comparison
              # feats = datasets.Features(
              #     {"image": datasets.Sequence(datasets.Value("float32"), SPEED_TEST_SHAPE[0] * SPEED_TEST_SHAPE[1])}
              # )
              lowercase			:   Optional[Any]					   =		datasets.Features({'''image''': datasets.Sequence(datasets.Value('''float32'''     )     )}     )
              lowercase			:   Optional[int]					   =		generate_examples(
                  features=_UpperCamelCase,    num_examples=_UpperCamelCase,    seq_shapes={'''image''': [SPEED_TEST_SHAPE[0] * SPEED_TEST_SHAPE[1]]},    )
              lowercase			:   int					   =		write(_UpperCamelCase,    _UpperCamelCase,    _UpperCamelCase     )
              for read_func in read_functions:
                    lowercase			:   List[Any]					   =		read_func(_UpperCamelCase,    _UpperCamelCase     )
  
        with open(_UpperCamelCase,    '''wb'''     ) as f:
              f.write(json.dumps(_UpperCamelCase     ).encode('''utf-8'''     )     )
  
  
  if __name__ == "__main__":  # useful to run the profiler
    benchmark_array_xd()
  
  
style_context: 
  
  
  from __future__ import annotations
  
  
  
  
  def 			__lowercase	(						_UpperCamelCase     )    ->list[int]:
  
  
  
  
  
  
  
        """simple docstring"""
  
        assert (
            isinstance(_UpperCamelCase,    _UpperCamelCase     ) and mask > 0
        ), f"""mask needs to be positive integer, your input {mask}"""
        lowercase			:   Optional[int]					   =		[]
        lowercase			:   Optional[int]					   =		mask
  
        while submask:
              all_submasks.append(_UpperCamelCase     )
              lowercase			:   Dict					   =		(submask - 1) & mask
  
        return all_submasks
  
  
  if __name__ == "__main__":
    import doctest
  
    doctest.testmod()
  
  