Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance improvements #606

Closed
abumq opened this issue Feb 9, 2018 · 0 comments
Closed

Performance improvements #606

abumq opened this issue Feb 9, 2018 · 0 comments

Comments

@abumq
Copy link
Owner

abumq commented Feb 9, 2018

1

Writer& Writer::construct(int count, const char* loggerIds, ...) {
  if (ELPP->hasFlag(LoggingFlag::MultiLoggerSupport)) {
    va_list loggersList;
    va_start(loggersList, loggerIds);
    const char* id = loggerIds;
    for (int i = 0; i < count; ++i) {
      m_loggerIds.push_back(std::string(id));

We can reserve space before pushing to speed up things. So just after const char* id = loggerIds; add m_loggerIds.reserve(count);

2

Provide interface for reserving space for custom format specifier so last line in this snippet could be sped up

void Storage::installCustomFormatSpecifier(const CustomFormatSpecifier& customFormatSpecifier) {
  if (hasCustomFormatSpecifier(customFormatSpecifier.formatSpecifier())) {
    return;
  }
  base::threading::ScopedLock scopedLock(lock());
  m_customFormatSpecifiers.push_back(customFormatSpecifier);
abumq added a commit that referenced this issue Feb 9, 2018
@abumq abumq closed this as completed in b218fd3 Feb 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant