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
  
  
  lowerCAmelCase					 =	(3_0, 4_8_7)
  lowerCAmelCase					 =	(3_6, 1_0_2_4)
  lowerCAmelCase					 =	(1_0_0, 1_0_0)
  lowerCAmelCase					 =	1_0_0
  
  lowerCAmelCase					 =	datasets.Features(
      {'''text''': ArrayaD(SHAPE_TEST_1, dtype='''float32'''), '''image''': ArrayaD(SHAPE_TEST_2, dtype='''float32''')}
  )
  
  lowerCAmelCase					 =	os.path.split(__file__)
  lowerCAmelCase					 =	os.path.join(RESULTS_BASEPATH, '''results''', RESULTS_FILENAME.replace('''.py''', '''.json'''))
  
  
  
  
  
  
  
  @get_duration
  def  _lowerCamelCase(			lowercase__     ,				lowercase__     ,				lowercase__			)		->			Any:
  
  		'''simple docstring'''
  
  
  
  
  
  
  
  		with ArrowWriter(features=__lowerCamelCase     ,				path=os.path.join(__lowerCamelCase     ,				'beta.arrow'			)			) as writer:
  				for key, record in dummy_data:
  						__lowercase=    my_features.encode_example(__lowerCamelCase			)
  						writer.write(__lowerCamelCase			)
  				__lowercase=    writer.finalize()
  
  
  
  
  
  
  
  @get_duration
  def  _lowerCamelCase(			lowercase__     ,				lowercase__			)		->			Optional[int]:
  
  		'''simple docstring'''
  
  
  
  
  
  
  
  		__lowercase=    datasets.Dataset.from_file(
  		    filename=os.path.join(__lowerCamelCase     ,				'beta.arrow'			)     ,				info=datasets.DatasetInfo(features=__lowerCamelCase			)			)
  		for _ in dataset:
  				pass
  
  
  
  
  
  
  
  @get_duration
  def  _lowerCamelCase(			lowercase__     ,				lowercase__			)		->			Dict:
  
  		'''simple docstring'''
  
  
  
  
  
  
  
  		__lowercase=    datasets.Dataset.from_file(
  		    filename=os.path.join(__lowerCamelCase     ,				'beta.arrow'			)     ,				info=datasets.DatasetInfo(features=__lowerCamelCase			)			)
  		dataset.set_format('numpy'			)
  		for _ in dataset:
  				pass
  
  
  
  
  
  
  
  @get_duration
  def  _lowerCamelCase(			lowercase__     ,				lowercase__			)		->			str:
  
  		'''simple docstring'''
  
  
  
  
  
  
  
  		__lowercase=    1_0
  		__lowercase=    datasets.Dataset.from_file(
  		    filename=os.path.join(__lowerCamelCase     ,				'beta.arrow'			)     ,				info=datasets.DatasetInfo(features=__lowerCamelCase			)			)
  		for i in range(0     ,				len(__lowerCamelCase			)     ,				__lowerCamelCase			):
  				__lowercase=    dataset[i : i + batch_size]
  
  
  
  
  
  
  
  @get_duration
  def  _lowerCamelCase(			lowercase__     ,				lowercase__			)		->			int:
  
  		'''simple docstring'''
  
  
  
  
  
  
  
  		__lowercase=    1_0
  		__lowercase=    datasets.Dataset.from_file(
  		    filename=os.path.join(__lowerCamelCase     ,				'beta.arrow'			)     ,				info=datasets.DatasetInfo(features=__lowerCamelCase			)			)
  		dataset.set_format('numpy'			)
  		for i in range(0     ,				len(__lowerCamelCase			)     ,				__lowerCamelCase			):
  				__lowercase=    dataset[i : i + batch_size]
  
  
  
  
  
  
  
  @get_duration
  def  _lowerCamelCase(			lowercase__     ,				lowercase__			)		->			List[Any]:
  
  		'''simple docstring'''
  
  
  
  
  
  
  
  		__lowercase=    datasets.Dataset.from_file(
  		    filename=os.path.join(__lowerCamelCase     ,				'beta.arrow'			)     ,				info=datasets.DatasetInfo(features=__lowerCamelCase			)			)
  		for col in feats:
  				__lowercase=    dataset[col]
  
  
  
  
  
  
  
  @get_duration
  def  _lowerCamelCase(			lowercase__     ,				lowercase__			)		->			List[Any]:
  
  		'''simple docstring'''
  
  
  
  
  
  
  
  		__lowercase=    datasets.Dataset.from_file(
  		    filename=os.path.join(__lowerCamelCase     ,				'beta.arrow'			)     ,				info=datasets.DatasetInfo(features=__lowerCamelCase			)			)
  		dataset.set_format('numpy'			)
  		for col in feats:
  				__lowercase=    dataset[col]
  
  
  
  
  
  
  
  def  _lowerCamelCase(			)		->			str:
  
  		'''simple docstring'''
  
  
  
  
  
  
  
  		__lowercase=    {}
  		__lowercase=    (
  		    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=    datasets.Features({'image': ArrayaD(__lowerCamelCase     ,				dtype='float32'			)}			)
  				__lowercase=    generate_examples(features=__lowerCamelCase     ,				num_examples=__lowerCamelCase			)
  				__lowercase=    write(__lowerCamelCase     ,				__lowerCamelCase     ,				__lowerCamelCase			)
  				for read_func in read_functions:
  						__lowercase=    read_func(__lowerCamelCase     ,				__lowerCamelCase			)
  
  		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=    datasets.Features({'image': datasets.Sequence(datasets.Sequence(datasets.Value('float32'			)			)			)}			)
  				__lowercase=    generate_examples(
  				    features=__lowerCamelCase     ,				num_examples=__lowerCamelCase     ,				seq_shapes={'image': SPEED_TEST_SHAPE}			)
  				__lowercase=    write(__lowerCamelCase     ,				__lowerCamelCase     ,				__lowerCamelCase			)
  				for read_func in read_functions:
  						__lowercase=    read_func(__lowerCamelCase     ,				__lowerCamelCase			)
  
  		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=    datasets.Features({'image': datasets.Sequence(datasets.Value('float32'			)			)}			)
  				__lowercase=    generate_examples(
  				    features=__lowerCamelCase     ,				num_examples=__lowerCamelCase     ,				seq_shapes={'image': [SPEED_TEST_SHAPE[0] * SPEED_TEST_SHAPE[1]]}     ,				)
  				__lowercase=    write(__lowerCamelCase     ,				__lowerCamelCase     ,				__lowerCamelCase			)
  				for read_func in read_functions:
  						__lowercase=    read_func(__lowerCamelCase     ,				__lowerCamelCase			)
  
  		with open(__lowerCamelCase     ,				'wb'			) as f:
  				f.write(json.dumps(__lowerCamelCase			).encode('utf-8'			)			)
  
  
  if __name__ == "__main__":  # useful to run the profiler
  	benchmark_array_xd()
  
  
  
  
  
  
  
style_context: 
  
  
  from __future__ import annotations
  
  from enum import Enum
  
  
  
  
  
  class    A					(     A_				):
  							UpperCamelCase_     :							List[Any] =24
  							UpperCamelCase_     :							List[Any] =21
  							UpperCamelCase_     :							int =18
  							UpperCamelCase_     :							Optional[int] =15
  							UpperCamelCase_     :							Tuple =12
  							UpperCamelCase_     :							List[str] =9
  							UpperCamelCase_     :							Any =6
  							UpperCamelCase_     :							List[str] =3
  							UpperCamelCase_     :							str =2
  							UpperCamelCase_     :							str =1
  							UpperCamelCase_     :							Optional[int] =-1
  							UpperCamelCase_     :							List[Any] =-2
  							UpperCamelCase_     :							str =-3
  							UpperCamelCase_     :							Tuple =-6
  							UpperCamelCase_     :							Tuple =-9
  							UpperCamelCase_     :							Optional[int] =-12
  							UpperCamelCase_     :							str =-15
  							UpperCamelCase_     :							Optional[Any] =-18
  							UpperCamelCase_     :							Any =-21
  							UpperCamelCase_     :							List[str] =-24
  
  
  
  
  
  class    A					(     A_				):
  							UpperCamelCase_     :							str =8
  							UpperCamelCase_     :							Optional[Any] =7
  							UpperCamelCase_     :							Tuple =6
  							UpperCamelCase_     :							List[Any] =5
  							UpperCamelCase_     :							Optional[Any] =4
  							UpperCamelCase_     :							Union[str, Any] =3
  							UpperCamelCase_     :							Union[str, Any] =2
  							UpperCamelCase_     :							int =1
  
  
  
  
  
  
  
  def  _lowerCamelCase(			lowercase__     ,				lowercase__     ,				lowercase__     ,				)		->			float:
  
  		'''simple docstring'''
  
  
  
  
  
  
  
  		if isinstance(lowercase__     ,				lowercase__			):
  				__lowercase=    SIUnit[known_prefix.lower()]
  		if isinstance(lowercase__     ,				lowercase__			):
  				__lowercase=    SIUnit[unknown_prefix.lower()]
  		__lowercase=    known_amount * (
  		    1_0 ** (known_prefix.value - unknown_prefix.value)
  		)
  		return unknown_amount
  
  
  
  
  
  
  
  def  _lowerCamelCase(			lowercase__     ,				lowercase__     ,				lowercase__     ,				)		->			float:
  
  		'''simple docstring'''
  
  
  
  
  
  
  
  		if isinstance(lowercase__     ,				lowercase__			):
  				__lowercase=    BinaryUnit[known_prefix.lower()]
  		if isinstance(lowercase__     ,				lowercase__			):
  				__lowercase=    BinaryUnit[unknown_prefix.lower()]
  		__lowercase=    known_amount * (
  		    2 ** ((known_prefix.value - unknown_prefix.value) * 1_0)
  		)
  		return unknown_amount
  
  
  if __name__ == "__main__":
  	import doctest
  
  	doctest.testmod()
  
  
  
  
  
  
  