From: Chunsong Feng Date: Tue, 29 Jun 2021 03:26:07 +0000 (+0000) Subject: common: Use double instead of long double to improve performance X-Git-Tag: v16.2.14~74^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=dbe3a962b59093d169c49de398966862a875b973;p=ceph.git common: Use double instead of long double to improve performance To convert namoseconds to seconds, the precision needs to be 10, and the precision of double is 15, which is enough to use. On aarch64, double division uses the div instruction, while long double uses the gcc buildin _divtf3, which has poor performance. Therefore, use double instead of long double for better performance. Signed-off-by: Chunsong Feng (cherry picked from commit 58753cf50e89cc3d7169447aa83d13cd3a8c0347) Signed-off-by: luo rixin --- diff --git a/src/include/utime.h b/src/include/utime.h index 512149db03e3..fad66af7939a 100644 --- a/src/include/utime.h +++ b/src/include/utime.h @@ -224,7 +224,7 @@ public: // cast to double operator double() const { - return (double)sec() + ((double)nsec() / 1000000000.0L); + return (double)sec() + ((double)nsec() / 1000000000.0f); } operator ceph_timespec() const { ceph_timespec ts;