From b662e73faca834648d7881e6d9bfe68af67ab0fb Mon Sep 17 00:00:00 2001 From: Lionel GUEZ <guez@lmd.ens.fr> Date: Thu, 21 Dec 2023 18:56:49 +0100 Subject: [PATCH] Save `time.perf_counter()` in t1 So we do not call `time.perf_counter()` a second time after a simple assignment. --- Inst_eddies/inst_eddies.py.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Inst_eddies/inst_eddies.py.in b/Inst_eddies/inst_eddies.py.in index c725b44e..cb08b619 100644 --- a/Inst_eddies/inst_eddies.py.in +++ b/Inst_eddies/inst_eddies.py.in @@ -35,8 +35,9 @@ def process_1_file(bbox, nco_instance, nc_file, cropped_fname, unpacked_fname, nc_file = cropped_fname nco_instance.ncpdq(nc_file, output = unpacked_fname, options = ["--unpack"]) - elapsed_NCO = time.perf_counter() - t0 - t0 = time.perf_counter() + t1 = time.perf_counter() + elapsed_NCO = t1 - t0 + t0 = t1 subprocess.run([inst_eddies_exe, unpacked_fname, unpacked_fname], check = True, input = f"&dates_nml date = {d}, " f"slice = {my_slice}/\n", text = True) -- GitLab