telefonicaid / fiware-orion

Context Broker and CEF building block for context data management, providing NGSI interfaces.
https://github.com/telefonicaid/fiware-orion/blob/master/doc/manuals/orion-api.md
GNU Affero General Public License v3.0
210 stars 265 forks source link

Disable LM_T in RELEASE compilation #1448

Open fgalan opened 9 years ago

fgalan commented 9 years ago

(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).

kzangeli commented 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.

fgalan commented 8 years ago

No actual change by the moment, just a comment at CMakeList (see commit 03544a6 in PR #1537)

fgalan commented 8 years ago

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.