From 2b7e0a05190b8f007ef8599e1447710e917b294b Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Tue, 6 Aug 2024 15:57:17 -0400 Subject: [PATCH] Change loop order to maximize cache hit It is better to write to memory that are grouped together to reduce probability of cache miss. This simple change improved the function's execution speed by 70%. Removed the unnecessary memset for the buffer. --- openair1/PHY/MODULATION/nr_modulation.c | 6 +++--- openair1/PHY/MODULATION/nr_modulation.h | 2 +- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c index ad84245f86..3285dab149 100644 --- a/openair1/PHY/MODULATION/nr_modulation.c +++ b/openair1/PHY/MODULATION/nr_modulation.c @@ -318,10 +318,10 @@ void nr_layer_mapping(int nbCodes, } } -void nr_ue_layer_mapping(const c16_t *mod_symbs, const int n_layers, const int n_symbs, int sz, c16_t tx_layers[][sz]) +void nr_ue_layer_mapping(const c16_t *mod_symbs, const int n_layers, const int n_symbs, c16_t tx_layers[][n_symbs]) { - for (int i=0; i