From 55b291e228179a32bb74de01ad87962e7b0c2da0 Mon Sep 17 00:00:00 2001 From: Sumit112192 Date: Sun, 28 Jul 2024 20:29:18 +0530 Subject: [PATCH] Add benchmark for the utility functions --- .../transport_montecarlo_packet_trackers.py | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/benchmarks/transport_montecarlo_packet_trackers.py b/benchmarks/transport_montecarlo_packet_trackers.py index c4b6c875407..a3f65f66f6d 100644 --- a/benchmarks/transport_montecarlo_packet_trackers.py +++ b/benchmarks/transport_montecarlo_packet_trackers.py @@ -4,6 +4,8 @@ from benchmarks.benchmark_base import BenchmarkBase from tardis.transport.montecarlo.packet_trackers import ( rpacket_trackers_to_dataframe, + generate_rpacket_tracker_list, + generate_rpacket_last_interaction_tracker_list, ) @@ -15,6 +17,20 @@ class BenchmarkTransportMontecarloPacketTrackers(BenchmarkBase): def time_rpacket_trackers_to_dataframe(self): sim = self.simulation_rpacket_tracking_enabled transport_state = sim.transport.transport_state - rpacket_trackers_to_dataframe( - transport_state.rpacket_tracker - ) + rpacket_trackers_to_dataframe(transport_state.rpacket_tracker) + + def time_generate_rpacket_tracker_list(self, no_of_packets, length): + generate_rpacket_tracker_list(no_of_packets, length) + + def time_generate_rpacket_last_interaction_tracker_list( + self, no_of_packets + ): + generate_rpacket_last_interaction_tracker_list(no_of_packets) + + time_generate_rpacket_tracker_list.params = ([1, 10, 50], [1, 10, 50]) + time_generate_rpacket_tracker_list.param_names = ["no_of_packets", "length"] + + time_generate_rpacket_last_interaction_tracker_list.params = [10, 100, 1000] + time_generate_rpacket_last_interaction_tracker_list.param_names = [ + "no_of_packets" + ]