4141 Union ,
4242)
4343import warnings
44+ import bigframes .perf_inspect as perf_inspect
4445
4546import bigframes_vendored .constants as constants
4647import google .cloud .bigquery as bigquery
@@ -940,6 +941,8 @@ def split(
940941 ]
941942 return [sliced_block .drop_columns (drop_cols ) for sliced_block in sliced_blocks ]
942943
944+
945+ @perf_inspect .runtime_logger
943946 def _compute_dry_run (
944947 self ,
945948 value_keys : Optional [Iterable [str ]] = None ,
@@ -1629,6 +1632,7 @@ def slice(
16291632 # Using cache to optimize for Jupyter Notebook's behavior where both '__repr__'
16301633 # and '__repr_html__' are called in a single display action, reducing redundant
16311634 # queries.
1635+ @perf_inspect .runtime_logger
16321636 @functools .cache
16331637 def retrieve_repr_request_results (
16341638 self , max_results : int
@@ -1646,22 +1650,29 @@ def retrieve_repr_request_results(
16461650 array_value = self .expr ,
16471651 config = executors .CacheConfig (optimize_for = "head" , if_cached = "reuse-strict" ),
16481652 )
1653+ import time
1654+ start_time = time .monotonic ()
16491655 head_result = self .session ._executor .execute (
16501656 self .expr .slice (start = None , stop = max_results , step = None ),
16511657 execution_spec .ExecutionSpec (
16521658 promise_under_10gb = True ,
16531659 ordered = True ,
16541660 ),
16551661 )
1662+ print ("Time taken to execute head: {:.2f} seconds" .format (time .monotonic () - start_time ))
1663+ start_time = time .monotonic ()
16561664 row_count = self .session ._executor .execute (
16571665 self .expr .row_count (),
16581666 execution_spec .ExecutionSpec (
16591667 promise_under_10gb = True ,
16601668 ordered = False ,
16611669 ),
16621670 ).to_py_scalar ()
1671+ print ("Time taken to execute row_count: {:.2f} seconds" .format (time .monotonic () - start_time ))
16631672
1673+ start_time = time .monotonic ()
16641674 head_df = head_result .to_pandas ()
1675+ print ("Time taken to execute to_pandas: {:.2f} seconds" .format (time .monotonic () - start_time ))
16651676 return self ._copy_index_to_pandas (head_df ), row_count , head_result .query_job
16661677
16671678 def promote_offsets (self , label : Label = None ) -> typing .Tuple [Block , str ]:
0 commit comments