





import json
import os
from dataclasses import dataclass

import numpy as np
import pyarrow as pa

import datasets
from utils import get_duration


_SCREAMING_SNAKE_CASE   						=		10_00_00_00_00_00
_SCREAMING_SNAKE_CASE   						=		1_00_00

_SCREAMING_SNAKE_CASE						,				_SCREAMING_SNAKE_CASE   						=		os.path.split(__file__)
_SCREAMING_SNAKE_CASE   						=		os.path.join(RESULTS_BASEPATH, """results""", RESULTS_FILENAME.replace(""".py""", """.json"""))


def 				SCREAMING_SNAKE_CASE__    (     __a ,			__a ):
	snake_case_		:      str           =						pa.Table.from_pydict({'col': [0] * chunk_size} )
	snake_case_		:      int           =						pa.concat_tables([table] * (num_examples // chunk_size) )
	return datasets.Dataset(__a ,			fingerprint='table_100B' )
@dataclass
class SCREAMING_SNAKE_CASE_    :
						__magic_name__:      int
						__magic_name__:      int
						__magic_name__:      int
						__magic_name__:      int






						def UpperCAmelCase_					(   self   :   str						)				->     Dict:







							"""simple docstring"""


							snake_case_		:      Optional[Any]           =						np.random.default_rng(self.seed						)
							snake_case_		:      Optional[Any]           =						rng.integers(low=self.low		, high=self.high		, size=self.size						).tolist()






						def __iter__(   self   :   Optional[Any]						)				->     Dict:







							"""simple docstring"""


							return iter(self._sampled_values						)






						def __len__(   self   :   List[str]						)				->     Optional[int]:







							"""simple docstring"""


							return self.size


@get_duration
def 				SCREAMING_SNAKE_CASE__    (     __a ):
	snake_case_		:      Tuple           =						dataset[0]


@get_duration
def 				SCREAMING_SNAKE_CASE__    (     __a ):
	snake_case_		:      Optional[int]           =						dataset[-1]


@get_duration
def 				SCREAMING_SNAKE_CASE__    (     __a ):
	snake_case_		:      Tuple           =						dataset[range(len(__a ) // 2 ,			len(__a ) // 2 + 10_24 )]


@get_duration
def 				SCREAMING_SNAKE_CASE__    (     __a ):
	snake_case_		:      List[str]           =						dataset[RandIter(0 ,			len(__a ) ,			10_24 ,			seed=42 )]


def 				SCREAMING_SNAKE_CASE__    (     ):
	snake_case_		:      str           =						{'num examples': SPEED_TEST_N_EXAMPLES}
	snake_case_		:      Tuple           =						(get_first_row, get_last_row, get_batch_of_aaaa_rows, get_batch_of_aaaa_random_rows)
	print('generating dataset' )
	snake_case_		:      Dict           =						generate_100B_dataset(num_examples=__a ,			chunk_size=__a )
	print('Functions' )
	for func in functions:
		print(func.__name__ )
		snake_case_		:      Optional[Any]           =						func(__a )

	with open(__a ,			'wb' ) as f:
		f.write(json.dumps(__a ).encode('utf-8' ) )


if __name__ == "__main__":  # useful to run the profiler
						benchmark_table_100B()








def 				SCREAMING_SNAKE_CASE__    (     __a ,			__a ):
	if len(str(__a ) ) == 1 or len(str(__a ) ) == 1:
		return a * b

	snake_case_		:      Dict           =						max(len(str(__a ) ) ,			len(str(__a ) ) )
	snake_case_		:      Tuple           =						ma // 2

	snake_case_    ,snake_case_		:      Tuple           =						divmod(__a ,			10**ma )
	snake_case_    ,snake_case_		:      int           =						divmod(__a ,			10**ma )

	snake_case_		:      str           =						karatsuba(__a ,			__a )
	snake_case_		:      List[str]           =						karatsuba((aa + aa) ,			(ba + ba) )
	snake_case_		:      Optional[Any]           =						karatsuba(__a ,			__a )

	return (z * 10 ** (2 * ma)) + ((y - z - x) * 10 ** (ma)) + (x)


def 				SCREAMING_SNAKE_CASE__    (     ):
	print(karatsuba(1_54_63 ,			2_34_89 ) )


if __name__ == "__main__":
						main()

