From: Radoslaw Zarzynski Date: Wed, 16 Oct 2024 12:37:48 +0000 (+0000) Subject: objclass: don't do costly string formatting when not needed X-Git-Tag: v20.0.0~231^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=99c40417ee22e18781c970d948270637a96f1e28;p=ceph.git objclass: don't do costly string formatting when not needed Special thanks and credits to Mark Kogan for profiling ceph-osd under the RGW list workload. In this particular workload the change is worth around 4.2% of CPU cycles [1]. However, it's not restricted to RGW's bucket listing nor `cls_rgw`; I think it affects every single cls plugin in the system. Signed-off-by: Radoslaw Zarzynski [1]: https://github.com/ceph/ceph/pull/60278#issuecomment-2416582108 --- diff --git a/src/osd/objclass.cc b/src/osd/objclass.cc index af6d76efa82..cc3109b246d 100644 --- a/src/osd/objclass.cc +++ b/src/osd/objclass.cc @@ -765,6 +765,11 @@ int cls_cxx_get_gathered_data(cls_method_context_t hctx, std::map_conf->subsys.should_gather(dout_subsys, level)) { + // if this early exit becomes visible in profiling, switch to + // the static, compile-time check as the dout does. + return 0; + } size_t size = 256; va_list ap; while (1) {