Skip to content

Use references when it's possible and other small enhancements.#198

Merged
pavel-shirshov merged 8 commits intosonic-net:masterfrom
pavel-shirshov:pavelsh/perf_2
May 2, 2018
Merged

Use references when it's possible and other small enhancements.#198
pavel-shirshov merged 8 commits intosonic-net:masterfrom
pavel-shirshov:pavelsh/perf_2

Conversation

@pavel-shirshov
Copy link
Contributor

  1. Use references as loop arguments
  2. Initialize class fields in initializer list
  3. Don't use std::move for return value
  4. Don't use compare method to compare two strings for equality
  5. Fix typo

@@ -101,13 +101,13 @@ static inline std::set<std::string> runRedisScript(DBConnector &db, const std::s
if (ctx->type == REDIS_REPLY_NIL)
Copy link
Contributor

@qiluo-msft qiluo-msft May 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if [](start = 8, length = 2)

if (ctx->type == REDIS_REPLY_NIL)
{
    SWSS_LOG_ERROR("Got EMPTY response type from redis %d", ctx->type);
}

else if (ctx->type != REDIS_REPLY_ARRAY)
{
    SWSS_LOG_ERROR("Got invalid response type from redis %d", ctx->type);
}
else
{
    for (size_t i = 0; i < ctx->elements; i++)
    {
        SWSS_LOG_DEBUG("Got element %lu %s", i, ctx->element[i]->str);
        ret.insert(ctx->element[i]->str);
    }
}
return ret;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any comments here

Copy link
Contributor

@jleveque jleveque May 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe Qi is presenting a refactored, simplified block of code to replace the entire block with. Note only one return statement. Not so much a comment, but rather a suggested replacement.

Copy link
Contributor

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As comment

@pavel-shirshov pavel-shirshov merged commit d2e627f into sonic-net:master May 2, 2018
@pavel-shirshov pavel-shirshov deleted the pavelsh/perf_2 branch May 2, 2018 02:09
prgeor pushed a commit to prgeor/sonic-swss-common that referenced this pull request Feb 27, 2025
…t#198)

sonic-config-engine now depends on sonic-yang-mgmt and sonic-yang-models, so we now need to install them as part of continuous integration to get the CI working again
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants