You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by ja...@apache.org on 2023/02/19 09:15:23 UTC
svn commit: r1907750 - /apr/apr/trunk/include/apr_file_info.h
Author: jailletc36
Date: Sun Feb 19 09:15:23 2023
New Revision: 1907750
URL: http://svn.apache.org/viewvc?rev=1907750&view=rev
Log:
Re-order the fields of 'struct apr_finfo_t' to avoid a hole and some padding.
On x86_64, this shrinks the size of the struct from 120 to 112 bytes.
Before the patch, pahole states that:
struct apr_finfo_t {
apr_pool_t * pool; /* 0 8 */
apr_int32_t valid; /* 8 4 */
apr_fileperms_t protection; /* 12 4 */
apr_filetype_e filetype; /* 16 4 */
apr_uid_t user; /* 20 4 */
apr_gid_t group; /* 24 4 */
/* XXX 4 bytes hole, try to pack */
apr_ino_t inode; /* 32 8 */
apr_dev_t device; /* 40 8 */
apr_int32_t nlink; /* 48 4 */
/* XXX 4 bytes hole, try to pack */
apr_off_t size; /* 56 8 */
/* --- cacheline 1 boundary (64 bytes) --- */
apr_off_t csize; /* 64 8 */
apr_time_t atime; /* 72 8 */
apr_time_t mtime; /* 80 8 */
apr_time_t ctime; /* 88 8 */
const char * fname; /* 96 8 */
const char * name; /* 104 8 */
struct apr_file_t * filehand; /* 112 8 */
/* size: 120, cachelines: 2, members: 17 */
/* sum members: 112, holes: 2, sum holes: 8 */
/* last cacheline: 56 bytes */
};
Modified:
apr/apr/trunk/include/apr_file_info.h
Modified: apr/apr/trunk/include/apr_file_info.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_file_info.h?rev=1907750&r1=1907749&r2=1907750&view=diff
==============================================================================
--- apr/apr/trunk/include/apr_file_info.h (original)
+++ apr/apr/trunk/include/apr_file_info.h Sun Feb 19 09:15:23 2023
@@ -188,12 +188,12 @@ struct apr_finfo_t {
apr_uid_t user;
/** The group id that owns the file */
apr_gid_t group;
+ /** The number of hard links to the file. */
+ apr_int32_t nlink;
/** The inode of the file. */
apr_ino_t inode;
/** The id of the device the file is on. */
apr_dev_t device;
- /** The number of hard links to the file. */
- apr_int32_t nlink;
/** The size of the file */
apr_off_t size;
/** The storage size consumed by the file */