Commit 078cbeeb authored by Andreas Schmidt's avatar Andreas Schmidt

+= performance TODOs

parent a74c2c83
Pipeline #4313 failed with stages
in 1 second
......@@ -6,6 +6,7 @@ import prrt_utils
class HECSearch:
# Optimization TODO: use cProfile
def __init__(self, searchType, n_p_min, n_p_max, prrtApplicationParameters, prrtChannelParameters,
prrtSystemParameters):
self.n_max = 255
......@@ -30,6 +31,7 @@ class HECSearch:
n_c_max = math.ceil((self.prrtApplicationParameters.max_latency - self.get_fec_delay_min()) /
(self.prrtChannelParameters.rtt_prop_fwd +
self.prrtSystemParameters.redundancy_packet_transmission_delay))
# Optimization TODO: min(n_c_max, n_c_cap)
if n_c_max > n_c_cap:
n_c_max = n_c_cap
# print("n_c_max=" + str(n_c_max))
......@@ -60,6 +62,7 @@ class HECSearch:
get_k_lim = self.get_k_lim(self.n_min, self.n_max)
if self.searchType == "GreedySearch":
# Optimization TODO: Consider vectorized / array operations to compute an array of n_c,k_max pairs
for n_c in range(1, n_c_max + 1):
get_k = self.get_k(n_c, arq_delay_i)
# print(str(get_k) + " " + str(get_k_lim))
......@@ -116,6 +119,7 @@ class HECSearch:
return self.get_k_lim(mid_point + 1, biggestK)
def estimate_n_for_k(self, k, n_max):
# Optimization TODO: binary search-like stepping
n = k + 1
while self.residual_packet_erasure_rate(k, n,
self.prrtChannelParameters.loss_rate_fwd) > self.prrtApplicationParameters.max_residual_loss_rate \
......@@ -124,6 +128,8 @@ class HECSearch:
return n
def residual_packet_erasure_rate(self, k, n, ch_loss_rate):
# Optimization TODO: iterators / map
# codingConf = prrt.PrrtCodingConfiguration(1,1,[0])
total_packet_erasure = 0
for i in range(1, k + 1):
......@@ -147,4 +153,4 @@ class HECSearch:
self.prrtChannelParameters.rtt_prop_fwd
def get_balance_delay_fec(self, np_zero, k):
return self.get_fec_delay(np_zero, k) / self.prrtApplicationParameters.max_latency
\ No newline at end of file
return self.get_fec_delay(np_zero, k) / self.prrtApplicationParameters.max_latency
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment