From 9dab030eeb5b5e65d22232ea582bf7b490bd8188 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Mon, 28 Nov 2016 12:22:19 +0100 Subject: [PATCH] lstm: Pass big parameter by reference (performance) Coverity report: CID 1366448 (#1 of 1): Big parameter passed by value (PASS_BY_VALUE) pass_by_value: Passing parameter recoder of type tesseract::UnicharCompress const (size 240 bytes) by value. Signed-off-by: Stefan Weil --- lstm/lstmtrainer.cpp | 2 +- lstm/lstmtrainer.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lstm/lstmtrainer.cpp b/lstm/lstmtrainer.cpp index 5865bc45b1..cd59dc5000 100644 --- a/lstm/lstmtrainer.cpp +++ b/lstm/lstmtrainer.cpp @@ -149,7 +149,7 @@ void LSTMTrainer::InitCharSet(const UNICHARSET& unicharset, // ctc_mode controls how the truth text is mapped to the network targets. // Note: Call before InitNetwork! void LSTMTrainer::InitCharSet(const UNICHARSET& unicharset, - const UnicharCompress recoder) { + const UnicharCompress& recoder) { // Call before InitNetwork. ASSERT_HOST(network_ == NULL); EmptyConstructor(); diff --git a/lstm/lstmtrainer.h b/lstm/lstmtrainer.h index e6a7c43f2e..17426c3c9e 100644 --- a/lstm/lstmtrainer.h +++ b/lstm/lstmtrainer.h @@ -113,7 +113,7 @@ class LSTMTrainer : public LSTMRecognizer { // previously setup UNICHARSET and UnicharCompress. // ctc_mode controls how the truth text is mapped to the network targets. // Note: Call before InitNetwork! - void InitCharSet(const UNICHARSET& unicharset, const UnicharCompress recoder); + void InitCharSet(const UNICHARSET& unicharset, const UnicharCompress& recoder); // Initializes the trainer with a network_spec in the network description // net_flags control network behavior according to the NetworkFlags enum.