Open fgalan opened 9 years ago
There is an if, comparing the variable 'silent' with TRUE, but there is also a function-call to lmOk(), doing this:
if (lmSilent == true)
{
return LmsNull;
}
if ((type == 'T') && (tLevel[tLev] == false))
{
return LmsNull;
}
... And a do {} while (0)
So, it is not "one if", there are a total of 6 "if-comparisons" and one function call. Now imagine this called for NO REASON whatsoever, a thousand times every second.
To me it is 100% clear this should be removed from the compilation. That's why I invented this possibility all those years ago.
Now, how much do we really save? Hard to say, must be measured.
No actual change by the moment, just a comment at CMakeList (see commit 03544a6 in PR #1537)
Some problems running make rpm
with add_definitions(-DLM_ON)
commented out:
...
cc1plus: warnings being treated as errors
/home/fermin/src/fiware-orion/rpm/BUILD/contextBroker-0.26.0_rc1_no_lmt/src/lib/mongoBackend/mongoQueryContext.cpp: In function 'HttpStatusCode mongoQueryContext(QueryContextRequest*, QueryContextResponse*, const std::string&, const std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >&, long long int*)':
Double check required, in order to discard problems in my environment.
(Related issue: https://github.com/telefonicaid/fiware-orion/issues/1427)
What we save? The
if
checking that is done each time LM_T is invoked. However, maybe is a little gain (to be evaluated).