Skip to content

ip tagging: fix old perf TODO in config constructor#7834

Merged
mattklein123 merged 1 commit intoenvoyproxy:masterfrom
derekargueta:dereka/ip-tagging-perf-todo
Aug 7, 2019
Merged

ip tagging: fix old perf TODO in config constructor#7834
mattklein123 merged 1 commit intoenvoyproxy:masterfrom
derekargueta:dereka/ip-tagging-perf-todo

Conversation

@derekargueta
Copy link
Copy Markdown
Member

@derekargueta derekargueta commented Aug 6, 2019

Description: Clears a TODO left by @ccaraman to reduce copies in IpTaggingFilterConfig constructor to construct the LC-trie. The optimization opportunities I found were

  1. pre-reserve std::vectors since size is known beforehand
  2. std::move into emplace_back for Network::Address::CidrRange to avoid copy constructor (can't use in-place construction since we check isValid() after construction)
  3. use in-place construction for std::pair<std::string, std::vector<Network::Address::CidrRange>> into emplace_back by perfect forwarding the constructor arguments

This isn't an online path (only called for config construction) so I think this suffices for optimizations here.

Risk Level: low
Testing: existing
Docs Changes: N/A
Release Notes: N/A

Signed-off-by: Derek Argueta dereka@pinterest.com

Signed-off-by: Derek Argueta <dereka@pinterest.com>
@derekargueta derekargueta changed the title ip tagging: fix old TODO ip tagging: fix old perf TODO in config constructor Aug 6, 2019
@jmarantz jmarantz self-assigned this Aug 6, 2019
@jmarantz
Copy link
Copy Markdown
Contributor

jmarantz commented Aug 6, 2019

@lizan for senior maintainer approval.

@mattklein123 mattklein123 merged commit feb56a1 into envoyproxy:master Aug 7, 2019
@derekargueta derekargueta deleted the dereka/ip-tagging-perf-todo branch October 8, 2019 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants