To my understanding, this is inefficient.
The return value of nlohmann::basic_json::find is an iterator, which will already contain the value we're looking for (or a reference to it) if it was found, but we throw it away and find the value again with nlohmann::basic_json::at.
At present, in
storage_tiering_configuration.cpp
, for each configuration value, we first check for the existence of the value withnlohmann::basic_json::find
, before fetching the value withnlohmann::basic_json::at
, like so: https://github.com/irods/irods_capability_storage_tiering/blob/7ec95618c6a94c358ce1ffec1fb05bc3e9b1352d/storage_tiering_configuration.cpp#L23-L26To my understanding, this is inefficient. The return value of
nlohmann::basic_json::find
is an iterator, which will already contain the value we're looking for (or a reference to it) if it was found, but we throw it away and find the value again withnlohmann::basic_json::at
.See
irods_server_properties.hpp
for an example of proper usage ofnlohmann::basic_json::find
: https://github.com/irods/irods/blob/84a09f945899b5ad85bb3d4cc451812e9dc05358/lib/core/include/irods_server_properties.hpp#L68-L71