]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
src/mgr/ClusterState.cc: micro improve ingest_pgstats 63792/head
authorKamoltat Sirivadhna <ksirivad@redhat.com>
Fri, 6 Jun 2025 22:43:23 +0000 (22:43 +0000)
committerKamoltat Sirivadhna <ksirivad@redhat.com>
Fri, 6 Jun 2025 22:43:23 +0000 (22:43 +0000)
commit70b41ea1ee8388d0e5910fd0a3ca3c9fb9e645ec
treebfb4ff4bc746e3df4a600577aa8b09417513a7d6
parentd9060d7c4ff13123b2677fbd37e1828352ebce71
src/mgr/ClusterState.cc: micro improve ingest_pgstats

As I was going through ClusterState::ingest_pgstats
I noticed some refractor + mini-optimization we can do
with iterators and how we are inserting in a map container.
Propose caching the end() iterator of map
and use insert_or_assign() when adding new or updating values.
insert_or_assign() is better than [] in that pg_stat_t contain
some vectors and maps, so for adding new pgs or new keys
insert_or_assign() will do a direct copy-construction, rather than
default construction and assign values which arguable has more
overhead.

Signed-off-by: Kamoltat Sirivadhna <ksirivad@redhat.com>
src/mgr/ClusterState.cc