icinga2 icon indicating copy to clipboard operation
icinga2 copied to clipboard

Try to avoid `ConfigObject::GetObject(const String&typeName,const String&objName)`

Open Al2Klimov opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe.

That method fetches the Type::Ptr by typeName on every call, using string lookup/comparision.

Describe the solution you'd like

If objects are fetched repeatedly for one and the same type, latter can be cached in a Type::Ptr or similar variable.

See everything of grep -rnFwe ConfigObject::GetObject lib tools which takes two non-template args.

Describe alternatives you've considered

At best, that variable is static const as in 33e609d7919b79fb2ae7877ab367389045b4dec9.

Additional context

Accidental finding during #10264.

Al2Klimov avatar Dec 17 '24 10:12 Al2Klimov

Raised a pr ,kindly assign it to me..

Akulbanxal avatar Aug 04 '26 10:08 Akulbanxal