com php-src: reduce realpath_cache_bucket size by 8 bytes on 64-bit: Zend/zend_virtual_cwd.c Zend/zend_virtual_cwd.h
| From: | Anatol Belski | Date: | Sun, 13 Nov 2016 19:21:44 +0000 |
| Subject: | com php-src: reduce realpath_cache_bucket size by 8 bytes on 64-bit: Zend/zend_virtual_cwd.c Zend/zend_virtual_cwd.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95757@lists.php.net to get a copy of this message | ||
Commit: 4d790486b8036a418544301425bc6f89db990d73
Author: Anatol Belski <ab@php.net> Sun, 13 Nov 2016 16:48:36 +0100
Parents: 882bcb724067a01daeae2adc5d6359807780f0ef
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4d790486b8036a418544301425bc6f89db990d73
Log:
reduce realpath_cache_bucket size by 8 bytes on 64-bit
This limits the path length to 64kb which is already far above the
use case. In return, the whole path cache storage size is reduced
by 8kb.
Changed paths:
M Zend/zend_virtual_cwd.c
M Zend/zend_virtual_cwd.h
Diff:
diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c
index 8192b42..420bc54 100644
--- a/Zend/zend_virtual_cwd.c
+++ b/Zend/zend_virtual_cwd.c
@@ -648,7 +648,7 @@ static inline void realpath_cache_add(const char *path, int path_len, const char
memcpy(bucket->realpath, realpath, realpath_len+1);
}
bucket->realpath_len = realpath_len;
- bucket->is_dir = is_dir;
+ bucket->is_dir = is_dir > 0;
#ifdef ZEND_WIN32
bucket->is_rvalid = 0;
bucket->is_readable = 0;
diff --git a/Zend/zend_virtual_cwd.h b/Zend/zend_virtual_cwd.h
index 1f927bb..538a2f8 100644
--- a/Zend/zend_virtual_cwd.h
+++ b/Zend/zend_virtual_cwd.h
@@ -204,14 +204,14 @@ typedef struct _realpath_cache_bucket {
char *realpath;
struct _realpath_cache_bucket *next;
time_t expires;
- int path_len;
- int realpath_len;
- int is_dir;
+ uint16_t path_len;
+ uint16_t realpath_len;
+ uint8_t is_dir:1;
#ifdef ZEND_WIN32
- unsigned char is_rvalid;
- unsigned char is_readable;
- unsigned char is_wvalid;
- unsigned char is_writable;
+ uint8_t is_rvalid:1;
+ uint8_t is_readable:1;
+ uint8_t is_wvalid:1;
+ uint8_t is_writable:1;
#endif
} realpath_cache_bucket;