Skip to content

Commit 66715ec

Browse files
committed
Reduce pandas overhead in compilation range name cleanup
1 parent 0299d5a commit 66715ec

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

.github/container/nsys_jax/nsys_jax/data_loaders.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -624,19 +624,19 @@ def _load_nvtx_pushpop_trace_single(name: pathlib.Path) -> pd.DataFrame:
624624
# Because the ProgramId and ProgramName ranges provide the same information,
625625
# remove those fields from the compilation range names.
626626
def remove_program_id_and_name(row):
627-
row.Name = (
627+
return (
628628
row.Name.removeprefix("TSL:")
629629
.replace(f",program_id={row.ProgramId}", "")
630630
.replace(f",module={row.ProgramName}", "")
631631
.replace(f":#module={row.ProgramName}#", "")
632632
)
633-
return row
634633

635-
return (
636-
compile_df.drop(columns=["EndMs"])
637-
.astype({"ProgramId": np.int32})
638-
.transform(remove_program_id_and_name, axis="columns")
639-
)
634+
compile_df = compile_df.drop(columns=["EndMs"]).astype({"ProgramId": np.int32})
635+
if len(compile_df):
636+
compile_df["Name"] = compile_df.apply(
637+
remove_program_id_and_name, axis="columns"
638+
)
639+
return compile_df
640640

641641

642642
def _load_nvtx_pushpop_trace(prefix: pathlib.Path, frames: set[str]) -> pd.DataFrame:

0 commit comments

Comments
 (0)